python-treq: bump to version 16.12.0
[buildroot-gz.git] / support / download / wget
blob768de904c3a5a19ddf3f9401e430d639e7ecdaf9
1 #!/usr/bin/env bash
3 # We want to catch any unexpected failure, and exit immediately
4 set -e
6 # Download helper for wget, to be called from the download wrapper script
8 # Call it as:
9 # .../wget [-q] OUT_FILE URL
11 # Environment:
12 # WGET : the wget command to call
14 verbose=
15 while getopts :q OPT; do
16 case "${OPT}" in
17 q) verbose=-q;;
18 \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
19 esac
20 done
21 shift $((OPTIND-1))
23 output="${1}"
24 url="${2}"
26 shift 2 # Get rid of our options
28 # Caller needs to single-quote its arguments to prevent them from
29 # being expanded a second time (in case there are spaces in them)
30 _wget() {
31 eval ${WGET} "${@}"
34 _wget ${verbose} "${@}" -O "'${output}'" "'${url}'"