diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-02-12 11:57:42 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-02-12 11:57:42 -0200 |
commit | 6b81ba9d352eb9e31d3c9ac2c466076c69a2f836 (patch) | |
tree | 85feb8d86164ea5895a85f8d6462d3bd40a68dcd /debian-dl | |
parent | 677a29ae4e3f9111fee7a358a969e4a022895b21 (diff) | |
download | scripts-6b81ba9d352eb9e31d3c9ac2c466076c69a2f836.tar.gz scripts-6b81ba9d352eb9e31d3c9ac2c466076c69a2f836.tar.bz2 |
Adding debian-dl script
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!" |