support/misc: Adding Vagrant file for provisioning
[buildroot-gz.git] / support / download / cp
blob09ce3d1100f07195765d0e77e1587d57b7c905e5
1 #!/usr/bin/env bash
3 # We want to catch any unexpected failure, and exit immediately
4 set -e
6 # Download helper for cp, to be called from the download wrapper script
8 # Call it as:
9 # .../cp [-q] OUT_FILE SRC_FILE
11 # Environment:
12 # LOCALFILES: the cp command to call
14 # 'cp' usually does not print anything on its stdout, whereas the
15 # other download backends, even if not verbose, at least print some
16 # progress information.
17 # Make 'cp' verbose by default, so it behaves a bit like the others.
18 verbose=-v
20 while getopts :q OPT; do
21 case "${OPT}" in
22 q) verbose=;;
23 \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
24 esac
25 done
26 shift $((OPTIND-1))
28 output="${1}"
29 source="${2}"
31 # Caller needs to single-quote its arguments to prevent them from
32 # being expanded a second time (in case there are spaces in them)
33 _localfiles() {
34 eval ${LOCALFILES} "${@}"
37 _localfiles ${verbose} "'${source}'" "'${output}'"