diff options
Diffstat (limited to 'debian-dl')
-rwxr-xr-x | debian-dl | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -4,15 +4,7 @@ # # Parameters -HASHES="MD5SUMS SHA1SUMS SHA256SUMS SHA512SUMS" - -# Arguments BASENAME="`basename $0`" -URL="$1" -BASE="`dirname $URL`" -RATE="$2" -FILENAME="`basename $URL`" -SIGN="sign" # Syntax if [ -z "$1" ]; then @@ -20,6 +12,14 @@ if [ -z "$1" ]; then exit 1 fi +# Arguments +URL="$1" +BASE="`dirname $URL`" +RATE="$2" +FILENAME="`basename $URL`" +SIGN="sign" +HASHES="MD5SUMS SHA1SUMS SHA256SUMS SHA512SUMS" + # Fetch hashes for hash in $HASHES; do wget -c $BASE/$hash @@ -69,13 +69,19 @@ fi # Check hashes for hash in $HASHES; do - echo "Checking $FILENAME against $hash file..." - check="`echo $hash | tr '[:upper:]' '[:lower:]' | sed -e 's/s$//'`" - grep -e "$FILENAME$" $hash | $check -c + if [ -e "$hash" ]; then + echo "Checking $FILENAME against $hash file..." + check="`echo $hash | tr '[:upper:]' '[:lower:]' | sed -e 's/s$//'`" + grep -e "$FILENAME$" $hash | $check -c + else + echo "$BASENAME: cannot check $hash: file not found, skipping" + fi done # Check hash integrity for hash in $HASHES; do - echo "Checking $hash.$SIGN..." - gpg --verify $hash.$SIGN + if [ -e "$hash" ]; then + echo "Checking $hash.$SIGN..." + gpg --verify $hash.$SIGN + fi done |