Skip to content

Commit

Permalink
Ensure extra config file is passed to docker
Browse files Browse the repository at this point in the history
Fixes RPi-Distro#253

Rather than use --env-file, which gets overwritten by the regular config file, pass the any arguments to build-docker.sh through to build.sh.
  • Loading branch information
samtygier authored and fuji246 committed Sep 13, 2019
1 parent 369d32a commit db1d8df
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions build-docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -e

BUILD_OPTS="$@"

DOCKER="docker"
set +e
$DOCKER ps >/dev/null 2>&1
Expand All @@ -13,19 +15,15 @@ if ! $DOCKER ps >/dev/null; then
fi
set -e

config_file=()
if [ -f config ]; then
config_file=("--env-file" "$(pwd)/config")
source config
fi

while getopts "c:" flag
do
case "$flag" in
c)
EXTRA_CONFIG="$OPTARG"
config_file=( "${config_file[@]}" "--env-file" "$(pwd)/${EXTRA_CONFIG}")
source "$EXTRA_CONFIG"
source "$OPTARG"
;;
esac
done
Expand Down Expand Up @@ -58,20 +56,17 @@ 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 \
--volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
-e IMG_NAME="${IMG_NAME}"\
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
cd /pi-gen; ./build.sh;
cd /pi-gen; ./build.sh ${BUILD_OPTS} ;
rsync -av work/*/build.log deploy/" &
wait "$!"
else
trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM
time $DOCKER run --name "${CONTAINER_NAME}" --privileged \
-e IMG_NAME="${IMG_NAME}"\
"${config_file[@]}" \
pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
cd /pi-gen; ./build.sh &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} &&
rsync -av work/*/build.log deploy/" &
wait "$!"
fi
Expand Down

0 comments on commit db1d8df

Please sign in to comment.