* Matthew Toseland <[EMAIL PROTECTED]> [2008-06-26 11:39:30]: > On Thursday 26 June 2008 09:43, NextGen$ wrote: > > * Matthew Toseland <[EMAIL PROTECTED]> [2008-06-26 02:17:28]: > > > > > On Sunday 01 June 2008 05:23, [EMAIL PROTECTED] wrote: > > > > Author: nextgens > > > > Date: 2008-06-01 04:23:44 +0000 (Sun, 01 Jun 2008) > > > > New Revision: 20171 > > > > > > > > Modified: > > > > trunk/apps/new_installer/scripts/update.sh > > > > Log: > > > > new_installer: simplify update.sh > > > > > > > > Modified: trunk/apps/new_installer/scripts/update.sh > > > > =================================================================== > > > > --- trunk/apps/new_installer/scripts/update.sh 2008-06-01 03:37:08 UTC > (rev > > > 20170) > > > > +++ trunk/apps/new_installer/scripts/update.sh 2008-06-01 04:23:44 UTC > (rev > > > 20171) > > > > + > > > > +file_md5sum_comp () { > > > > + if file_exist "$1" "$2" > > > > + then > > > > + MD5_FILE1="`cat \"$1\"|md5sum`" > > > > + MD5_FILE2="`cat \"$2\"|md5sum`" > > > > + return `test "$MD5_FILE1" = "$MD5_FILE2"` > > > > > > Doesn't work. The output of md5sum includes the filename, you need to > > > chop > it > > > out. > > > > > > > Which in that case is "-"; why do I need to chop it exactly ? > > Doh. > > > > > > + else > > > > + return 1 > > > > + fi > > > > +} > > > > + > > > > +file_sha1sum_comp () { > > > > + if file_exist "$1" "$2" > > > > + then > > > > + SHA1_FILE1="`cat \"$1\"|sha1sum`" > > > > + SHA1_FILE2="`cat \"$2\"|sha1sum`" > > > > + echo $SHA1_FILE1 $SHA1_FILE2 > > > > + return `test "$SHA1_FILE1" = "$SHA1_FILE2"` > > > > > > Likewise. > > > > > > > + else > > > > + return 1 > > > > + fi > > > > +} > > > > + > > > > +# Determine which one we will use > > > > +if test ! -x "`which sha1sum`" > > > > +then > > > > + if test ! -x "`which md5sum`" > > > > + then > > > > + if test ! -x "`which cmp`" > > > > + then > > > > + echo "No cmp nor md5sum nor sha1sum utility > > > > detected; Please install > one > > > of those" > > > > + exit 1 > > > > + else > > > > + CMP="invert_return_code file_cmp_comp" > > > > + fi > > > > + else > > > > + CMP="invert_return_code file_md5sum_comp" > > > > + fi > > > > +else > > > > + CMP="invert_return_code file_sha1sum_comp" > > > > +fi > > > > > > We should really use cmp if it's available, it's quicker. > > > > It s not a matter of speed, we need a hash function > > We need a hash function if we don't have cmp. cmp is preferable if we DO have > it, we should check for it first.
We need a hash function to ensure sha1test is up to date... the idea here was to reduce the number of dependancies. By the way, I have heard of a few implementations of cmp which are only comparing timestamps... imho we can't rely on that. _______________________________________________ Devl mailing list Devl@freenetproject.org http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl