diff options
Diffstat (limited to 'debian-dl')
-rwxr-xr-x | debian-dl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/debian-dl b/debian-dl new file mode 100755 index 0000000..2566b4f --- /dev/null +++ b/debian-dl @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Simple Debian image downloader. +# + +# Parameters +HASHES="MD5SUMS SHA1SUMS SHA256SUMS SHA512SUMS" + +# Arguments +BASENAME="`basename $0`" +URL="$1" +BASE="`dirname $URL`" +RATE="$2" + +# Syntax +if [ -z "$1" ]; then + echo "usage: $BASENAME <image-url>" + exit 1 +fi + +# Fetch hashes +for hash in $HASHES; do + wget -c $BASE/$hash + wget -c $BASE/$hash.sig +done + +# Set rate limit +if [ ! -z "$RATE" ]; then + LIMIT="--limit-rate=$RATE" +fi + +# Get the image +wget -c $LIMIT $URL + +# Teardown +echo "Please check `basename $URL` integrity!" |