fix: support bash v3 by removing array usage (#705)
This commit is contained in:
parent
446f3e34c8
commit
ed68013abb
@ -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="$*"
|
BUILD_OPTS="$*"
|
||||||
|
|
||||||
@ -93,18 +95,12 @@ ${DOCKER} build --build-arg BASE_IMAGE=${BASE_IMAGE} -t pi-gen "${DIR}"
|
|||||||
|
|
||||||
if [ "${CONTAINER_EXISTS}" != "" ]; then
|
if [ "${CONTAINER_EXISTS}" != "" ]; then
|
||||||
DOCKER_CMDLINE_NAME="${CONTAINER_NAME}_cont"
|
DOCKER_CMDLINE_NAME="${CONTAINER_NAME}_cont"
|
||||||
DOCKER_CMDLINE_PRE=( \
|
DOCKER_CMDLINE_PRE="--rm"
|
||||||
--rm \
|
DOCKER_CMDLINE_POST="--volumes-from=\"${CONTAINER_NAME}\""
|
||||||
)
|
|
||||||
DOCKER_CMDLINE_POST=( \
|
|
||||||
--volumes-from="${CONTAINER_NAME}" \
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
DOCKER_CMDLINE_NAME="${CONTAINER_NAME}"
|
DOCKER_CMDLINE_NAME="${CONTAINER_NAME}"
|
||||||
DOCKER_CMDLINE_PRE=( \
|
DOCKER_CMDLINE_PRE=""
|
||||||
)
|
DOCKER_CMDLINE_POST=""
|
||||||
DOCKER_CMDLINE_POST=( \
|
|
||||||
)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if binfmt_misc is required
|
# 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
|
trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM
|
||||||
time ${DOCKER} run \
|
time ${DOCKER} run \
|
||||||
"${DOCKER_CMDLINE_PRE[@]}" \
|
$DOCKER_CMDLINE_PRE \
|
||||||
--name "${DOCKER_CMDLINE_NAME}" \
|
--name "${DOCKER_CMDLINE_NAME}" \
|
||||||
--privileged \
|
--privileged \
|
||||||
--cap-add=ALL \
|
--cap-add=ALL \
|
||||||
@ -154,7 +150,7 @@ time ${DOCKER} run \
|
|||||||
${PIGEN_DOCKER_OPTS} \
|
${PIGEN_DOCKER_OPTS} \
|
||||||
--volume "${CONFIG_FILE}":/config:ro \
|
--volume "${CONFIG_FILE}":/config:ro \
|
||||||
-e "GIT_HASH=${GIT_HASH}" \
|
-e "GIT_HASH=${GIT_HASH}" \
|
||||||
"${DOCKER_CMDLINE_POST[@]}" \
|
$DOCKER_CMDLINE_POST \
|
||||||
pi-gen \
|
pi-gen \
|
||||||
bash -e -o pipefail -c "
|
bash -e -o pipefail -c "
|
||||||
dpkg-reconfigure qemu-user-static &&
|
dpkg-reconfigure qemu-user-static &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user