aboutsummaryrefslogtreecommitdiff
path: root/debian-dl
blob: 2566b4faf353c2877e3c61c8691c2e4305dbe885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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!"