summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.com>2023-03-28 17:21:32 +0100
committerSerge Schneider <serge@raspberrypi.com>2023-03-28 17:21:32 +0100
commit84746b2bcdf1bff48727745b5c21bb67554f60e8 (patch)
tree4d2e032df068debb051fb3c7a766b6c7ee028979
parent3e8046da4cd3f1b7ff51ab003e4fce8001b70d85 (diff)
parentb8437a77ba9e52ae23ee80414198d5d92f2babf5 (diff)
Merge branch 'master' into arm64
-rwxr-xr-xbuild-docker.sh65
1 files changed, 34 insertions, 31 deletions
diff --git a/build-docker.sh b/build-docker.sh
index 1b9a7b4..0258920 100755
--- a/build-docker.sh
+++ b/build-docker.sh
@@ -83,40 +83,43 @@ BUILD_OPTS="$(echo "${BUILD_OPTS:-}" | sed -E 's@\-c\s?([^ ]+)@-c /config@')"
${DOCKER} build --build-arg BASE_IMAGE=debian:bullseye -t pi-gen "${DIR}"
if [ "${CONTAINER_EXISTS}" != "" ]; then
- trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM
- time ${DOCKER} run --rm --privileged \
- --cap-add=ALL \
- -v /dev:/dev \
- -v /lib/modules:/lib/modules \
- ${PIGEN_DOCKER_OPTS} \
- --volume "${CONFIG_FILE}":/config:ro \
- -e "GIT_HASH=${GIT_HASH}" \
- --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
- pi-gen \
- bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
- # binfmt_misc is sometimes not mounted with debian bullseye image
- (mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true) &&
- cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
- rsync -av work/*/build.log deploy/" &
- wait "$!"
+ DOCKER_CMDLINE_NAME="${CONTAINER_NAME}_cont"
+ DOCKER_CMDLINE_PRE=( \
+ --rm \
+ )
+ DOCKER_CMDLINE_POST=( \
+ --volumes-from="${CONTAINER_NAME}" \
+ )
else
- trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM
- time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \
- --cap-add=ALL \
- -v /dev:/dev \
- -v /lib/modules:/lib/modules \
- ${PIGEN_DOCKER_OPTS} \
- --volume "${CONFIG_FILE}":/config:ro \
- -e "GIT_HASH=${GIT_HASH}" \
- pi-gen \
- bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
- # binfmt_misc is sometimes not mounted with debian bullseye image
- (mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true) &&
- cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
- rsync -av work/*/build.log deploy/" &
- wait "$!"
+ DOCKER_CMDLINE_NAME="${CONTAINER_NAME}"
+ DOCKER_CMDLINE_PRE=( \
+ )
+ DOCKER_CMDLINE_POST=( \
+ )
fi
+trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${DOCKER_CMDLINE_NAME}' SIGINT SIGTERM
+time ${DOCKER} run \
+ "${DOCKER_CMDLINE_PRE[@]}" \
+ --name "${DOCKER_CMDLINE_NAME}" \
+ --privileged \
+ --cap-add=ALL \
+ -v /dev:/dev \
+ -v /lib/modules:/lib/modules \
+ ${PIGEN_DOCKER_OPTS} \
+ --volume "${CONFIG_FILE}":/config:ro \
+ -e "GIT_HASH=${GIT_HASH}" \
+ "${DOCKER_CMDLINE_POST[@]}" \
+ pi-gen \
+ bash -e -o pipefail -c "
+ dpkg-reconfigure qemu-user-static &&
+ # binfmt_misc is sometimes not mounted with debian bullseye image
+ (mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true) &&
+ cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
+ rsync -av work/*/build.log deploy/
+ " &
+ wait "$!"
+
# Ensure that deploy/ is always owned by calling user
echo "copying results from deploy/"
${DOCKER} cp "${CONTAINER_NAME}":/pi-gen/deploy - | tar -xf -