Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: jls on March 06, 2009, 03:21:45 PM

Title: tce upgrade script missing
Post by: jls on March 06, 2009, 03:21:45 PM
It would be useful a tce upgrade script that checks and eventually download extensions from the repository if newer then the local that the user has.
Title: Re: tce upgrade script missing
Post by: Jason W on March 06, 2009, 06:07:40 PM
Actually the ability to remove and upgrade libraries was one of the reasons behind the uninstall utilities.  But we had removed the version numbers from the names of extensions, especially library ones to reduce the need to constantly update .dep files with each time a library extension was updated.  Without those version numbers in the extension name, there is no simple and reliable way to automate checking for newer extensions.  Well, the timestamps of the extensions on ibiblio could be compared with files in the system.  But to be honest I think this is a degree of automation that goes well beyond what a nomadic, normally RAM based system needs.  Personally I would rather make the decision of which extensions in the system to remove and upgrade on a one by one basis.
Title: Re: tce upgrade script missing
Post by: mikshaw on March 06, 2009, 08:37:54 PM
I suppose you could theoretically make a script that checks the date that the desired extension is added to the repository...don't know how reliable that would be.

I'm with Jason, though.  There's only so far an automated system can go before it gets into an area where there is a whole lot of extra code written just to check and compare files, when it's just simper to leave it up to the user to download what you want.  Honestly, the abilitiy of keeping packages updated all the time is overrated.  Some apps I use have had multiple upgrades over the years, but I see no reason to grab those upgrades because they really don't make the app any better for me.
Title: Re: tce upgrade script missing
Post by: jls on March 07, 2009, 12:00:25 AM
the version of an extension is written in the info file
Title: Re: tce upgrade script missing
Post by: curaga on March 07, 2009, 04:09:59 AM
If the extension is stored somewhere, the md5sum could be checked. If it's not the same as the latest from ibiblio, a newer extension would be available.
Title: Re: tce upgrade script missing
Post by: Jason W on March 07, 2009, 04:40:50 AM
Md5 would work if the extension was kept.  But to support PPI the timestamp of the /usr/local/tce.installed files could be compared to the extensions on ibiblio.  TC's time and date routine seems to work well even though my system clocks are in poor maintenance. 

That or the script fetching the version number from the info file on the server and storing it, and then comparing it to what is available on the server with each run.
Title: Re: tce upgrade script missing
Post by: tobiaus on March 08, 2009, 06:23:32 PM
hopefully this would be an extension, too.
Title: Re: tce upgrade script missing
Post by: florian on March 09, 2009, 04:09:25 PM
Hi,
I had created this script to check wether I had latest version of a particular extension.
Maybe the participants of this thread will find it useful too.

Code: [Select]
#!/bin/sh

# computes a md5sum of the tce/tcz extension file passed as a parameter,
# and compares it with the md5 checksum stored on the online repository.

# this for instance allows to detect if a new version of an extension
# is available.

MD5=/tmp/$(basename $0)_$$.md5
clean() { rm -f $MD5 $MD5.server 2>/dev/null ; }
die() { echo "$1"; clean; exit 1; }
. /etc/init.d/tc-functions

[ $# = 1 ] || die "Usage: $(basename $0) EXTENSION"
[ -f "$1" ] || die "$1: no such file"

MIRROR=`awk '/Mirror/ {print $2}' /opt/.tcrc`
PROTOCOL=`awk '/Protocol/ {print $2}' /opt/.tcrc`
stringinstring .tce "$1" && REPO="tce"
stringinstring .tcz "$1" && REPO="tcz"

[ -z $REPO ] && die "$1: not a tce or tcz extension file"
URL="$PROTOCOL"://"$MIRROR"/"$REPO"/"$1"

trap clean SIGHUP SIGINT SIGTERM
md5sum "$1" > $MD5
wget -q "$URL.md5.txt" -O $MD5.server || die "can't fetch checksum from server"
diff $MD5 $MD5.server > /dev/null || die "differs from server"
clean
Title: Re: tce upgrade script missing
Post by: jpeters on March 09, 2009, 06:43:08 PM
I haven't looked at it very closely...just copied/pasted and ran...."upgrade_script /tcZ/extension.tcz".
Couldn't get it to work...just got  "wget: server returned error: HTTP/1.1 404 Not Found
can't fetch checksum from server"   
Title: Re: tce upgrade script missing
Post by: tobiaus on March 09, 2009, 08:40:34 PM
i can't ever use wget to download anything from the main download site., for this reason. if you make aria2 a dep of this uninstaller, i've used that to download tinycore instead of wget.

you could try using ftp instead of http? tce-fetch uses wget -q, but i don't know why it succeeds.
Title: Re: tce upgrade script missing
Post by: jls on May 03, 2009, 03:36:25 PM
if u launch this script from a dir containg extensions and u save the script made above by florian tce-chk.sh
my script elencates at the end all the extensions that are not up to date.

Code: [Select]
#!/bin/sh
#controlla se tutte le estensioni presenti directory corrente sono aggiornate
#checks if all the extensions in the current dir are uptodate
#jls_legalze unsenepopiu at tin dot it

FILETMP=`mktemp`
for FILE in *; do
if [ -f $FILE ]; then
estensione=${FILE##*.}
if [ $estensione = tce ] || [ $estensione = tcz ] || [ $estensione = tcel ] || [ $estensione = tczl ] || [ $estensione = tcem ] || [ $estensione = tczm ] || [ $estensione = tcelm ] || [ $estensione = tczlm ]; then
if [ `tce-chk.sh $FILE` ]; then
echo "ok"
else
echo "errori:"
echo $FILE >> $FILETMP
fi
fi
fi
done
cat $FILETMP
rm -f $FILETMP