From 066478cac3d8bb7bd89d59584c49f1c25f8d6085 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 8 Oct 2022 11:52:32 -0300 Subject: Fixes for debian-dl --- debian-dl | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'debian-dl') diff --git a/debian-dl b/debian-dl index 8e16718..b9306b2 100755 --- a/debian-dl +++ b/debian-dl @@ -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 -- cgit v1.2.3