aboutsummaryrefslogtreecommitdiff
path: root/debian-dl
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-02-12 11:57:42 -0200
committerSilvio Rhatto <rhatto@riseup.net>2014-02-12 11:57:42 -0200
commit6b81ba9d352eb9e31d3c9ac2c466076c69a2f836 (patch)
tree85feb8d86164ea5895a85f8d6462d3bd40a68dcd /debian-dl
parent677a29ae4e3f9111fee7a358a969e4a022895b21 (diff)
downloadscripts-6b81ba9d352eb9e31d3c9ac2c466076c69a2f836.tar.gz
scripts-6b81ba9d352eb9e31d3c9ac2c466076c69a2f836.tar.bz2
Adding debian-dl script
Diffstat (limited to 'debian-dl')
-rwxr-xr-xdebian-dl36
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!"