summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hromic <hhromic@users.noreply.github.com>2019-02-15 12:49:00 +0000
committerXECDesign <XECDesign@users.noreply.github.com>2019-02-18 09:21:10 +0000
commit3b90b7ffed64802fdab9de096ded74dbcc909a90 (patch)
treecfe5933eca7c242445b2e7278f2e5c191e4493d3
parent3961bff8a401588d9a5d32066175aad605671768 (diff)
Improve bootstrap() function in common script
* Tidy up and simplify function code * Allow to pass extra arguments to debootstrap, e.g. `--variant minbase` * Preserve compatibility with existing function calls
-rw-r--r--scripts/common21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/common b/scripts/common
index bdddead..05198b7 100644
--- a/scripts/common
+++ b/scripts/common
@@ -4,21 +4,22 @@ log (){
export -f log
bootstrap(){
- local ARCH
- ARCH=$(dpkg --print-architecture)
+ local BOOTSTRAP_CMD=debootstrap
+ local BOOTSTRAP_ARGS=()
export http_proxy=${APT_PROXY}
- if [ "$ARCH" != "armhf" ]; then
- local BOOTSTRAP_CMD=qemu-debootstrap
- else
- local BOOTSTRAP_CMD=debootstrap
+ if [ "$(dpkg --print-architecture)" != "armhf" ]; then
+ BOOTSTRAP_CMD=qemu-debootstrap
fi
- capsh --drop=cap_setfcap -- "${BOOTSTRAP_CMD}" --components=main,contrib,non-free \
- --arch armhf \
- --keyring "${STAGE_DIR}/files/raspberrypi.gpg" \
- "$1" "$2" "$3" || true
+ BOOTSTRAP_ARGS+=(--arch armhf)
+ BOOTSTRAP_ARGS+=(--components "main,contrib,non-free")
+ BOOTSTRAP_ARGS+=(--keyring "${STAGE_DIR}/files/raspberrypi.gpg")
+ BOOTSTRAP_ARGS+=("$@")
+
+ capsh --drop=cap_setfcap -- "${BOOTSTRAP_CMD}" "${BOOTSTRAP_ARGS[@]}" || true
+
if [ -d "$2/debootstrap" ]; then
rmdir "$2/debootstrap"
fi