diff options
| author | Reuben Miller <reuben.d.miller@gmail.com> | 2023-09-25 15:59:25 +0200 |
|---|---|---|
| committer | Serge Schneider <serge@raspberrypi.com> | 2023-09-25 15:04:19 +0100 |
| commit | ed68013abbe46c0f665a157a9bdfd06603811101 (patch) | |
| tree | f542aeb0f66a33d3a4141f149f96a272817c92ae | |
| parent | 446f3e34c8ceb33dfe7bd38578f1cd6b6afe19da (diff) | |
fix: support bash v3 by removing array usage (#705)
| -rwxr-xr-x | build-docker.sh | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/build-docker.sh b/build-docker.sh index 4fdd89c..3445a40 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,6 +1,8 @@ -#!/bin/bash -eu +#!/usr/bin/env bash +# Note: Avoid usage of arrays as MacOS users have an older version of bash (v3.x) which does not supports arrays +set -eu -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)" BUILD_OPTS="$*" @@ -93,18 +95,12 @@ ${DOCKER} build --build-arg BASE_IMAGE=${BASE_IMAGE} -t pi-gen "${DIR}" if [ "${CONTAINER_EXISTS}" != "" ]; then DOCKER_CMDLINE_NAME="${CONTAINER_NAME}_cont" - DOCKER_CMDLINE_PRE=( \ - --rm \ - ) - DOCKER_CMDLINE_POST=( \ - --volumes-from="${CONTAINER_NAME}" \ - ) + DOCKER_CMDLINE_PRE="--rm" + DOCKER_CMDLINE_POST="--volumes-from=\"${CONTAINER_NAME}\"" else DOCKER_CMDLINE_NAME="${CONTAINER_NAME}" - DOCKER_CMDLINE_PRE=( \ - ) - DOCKER_CMDLINE_POST=( \ - ) + DOCKER_CMDLINE_PRE="" + DOCKER_CMDLINE_POST="" fi # Check if binfmt_misc is required @@ -145,7 +141,7 @@ fi trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM time ${DOCKER} run \ - "${DOCKER_CMDLINE_PRE[@]}" \ + $DOCKER_CMDLINE_PRE \ --name "${DOCKER_CMDLINE_NAME}" \ --privileged \ --cap-add=ALL \ @@ -154,7 +150,7 @@ time ${DOCKER} run \ ${PIGEN_DOCKER_OPTS} \ --volume "${CONFIG_FILE}":/config:ro \ -e "GIT_HASH=${GIT_HASH}" \ - "${DOCKER_CMDLINE_POST[@]}" \ + $DOCKER_CMDLINE_POST \ pi-gen \ bash -e -o pipefail -c " dpkg-reconfigure qemu-user-static && |
