diff options
| author | Reuben Miller <reuben.d.miller@gmail.com> | 2023-09-25 15:59:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-25 14:59:25 +0100 |
| commit | 77706bd2f6b77fbdbc329267f8386a38e4704c34 (patch) | |
| tree | c4efc61afe5d4a2bdc17bda9a5f8bd434d299d7b | |
| parent | e484aa85818428c3af08de0ba1db5329dfc84143 (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 38ae9ca..8d71b0f 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="$*" @@ -84,18 +86,12 @@ ${DOCKER} build --build-arg BASE_IMAGE=debian:bullseye -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 @@ -136,7 +132,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 \ @@ -145,7 +141,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 && |
