blob: a32d05273e89ef08d26ac77960d3863771028758 (
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
|
#!/bin/sh
set -e
set -u
fatal () {
echo "$@" >&2
exit 1
}
archive="$1"
url="$2"
shift 2
wget=`type -p wget || true`
curl=`type -p curl || true`
if [ -n "$wget" ]; then
$wget -O "$archive" "$url" || ( rm -f "$archive"; fatal "download failed" )
elif [ -n "$curl" ]; then
$curl -L -v "$url" > "$archive" || ( rm -f "$archive"; fatal "download failed" )
else
fatal "Don't know how to download"
fi
|