From: Silvio Rhatto Date: Wed, 12 Feb 2014 13:57:42 +0000 (-0200) Subject: Adding debian-dl script X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=6b81ba9d352eb9e31d3c9ac2c466076c69a2f836;p=scripts.git Adding debian-dl script --- 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 " + 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!"