aboutsummaryrefslogtreecommitdiff
path: root/debian-dl
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2022-10-08 11:52:32 -0300
committerSilvio Rhatto <rhatto@riseup.net>2022-10-08 11:52:32 -0300
commit066478cac3d8bb7bd89d59584c49f1c25f8d6085 (patch)
tree0ee60da9f359fbae3dc36e36ae392c7d54e335e0 /debian-dl
parent3c9e473053ae2d051c276e0c267270fca376b77c (diff)
downloaddownloaders-066478cac3d8bb7bd89d59584c49f1c25f8d6085.tar.gz
downloaders-066478cac3d8bb7bd89d59584c49f1c25f8d6085.tar.bz2
Fixes for debian-dl
Diffstat (limited to 'debian-dl')
-rwxr-xr-xdebian-dl32
1 files changed, 19 insertions, 13 deletions
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