On Sunday 01 June 2008 05:23, nextgens at freenetproject.org 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.

> +     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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080626/cb329cd2/attachment.pgp>

Reply via email to