870ce8d079cbbe9739181b4ed6bec8dac8772471
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / support / download / bzr
1 #!/usr/bin/env bash
2
3 # We want to catch any unexpected failure, and exit immediately
4 set -e
5
6 # Download helper for bzr, to be called from the download wrapper script
7 #
8 # Call it as:
9 #   .../bzr [-q] OUT_FILE REPO_URL REV BASENAME
10 #
11 # Environment:
12 #   BZR      : the bzr command to call
13
14
15 verbose=-v
16 while getopts :q OPT; do
17     case "${OPT}" in
18     q)  verbose=-q;;
19     \?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
20     esac
21 done
22 shift $((OPTIND-1))
23
24 output="${1}"
25 repo="${2}"
26 rev="${3}"
27 basename="${4}"
28
29 ${BZR} export ${verbose} --root="${basename}/" --format=tgz "${output}" "${repo}" -r "${rev}"