diff --git a/README.md b/README.md index 1e2453b..b770309 100755 --- a/README.md +++ b/README.md @@ -139,6 +139,12 @@ continue: CONTINUE=1 ./build-docker.sh ``` +After successful build, the build container is by default removed. This may be undesired when making incremental changes to a customized build. To prevent the build script from remove the container add + +```bash +PRESERVE_CONTAINER=1 ./build-docker.sh +``` + There is a possibility that even when running from a docker container, the installation of `qemu-user-static` will silently fail when building the image because `binfmt-support` _must be enabled on the underlying kernel_. An easy diff --git a/build-docker.sh b/build-docker.sh index e0a9b90..b683d4b 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -21,6 +21,7 @@ fi CONTAINER_NAME=${CONTAINER_NAME:-pigen_work} CONTINUE=${CONTINUE:-0} +PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0} if [ "$*" != "" ] || [ -z "${IMG_NAME}" ]; then if [ -z "${IMG_NAME}" ]; then @@ -33,6 +34,7 @@ Usage: Optional environment arguments: ( = ) CONTAINER_NAME=pigen_work set a name for the build container CONTINUE=1 continue from a previously started container + PRESERVE_CONTAINER=1 keep build container even on successful build EOF exit 1 fi @@ -75,6 +77,10 @@ fi echo "copying results from deploy/" $DOCKER cp "${CONTAINER_NAME}":/pi-gen/deploy . ls -lah deploy -$DOCKER rm -v $CONTAINER_NAME + +# cleanup +if [ "$PRESERVE_CONTAINER" != "1" ]; then + $DOCKER rm -v $CONTAINER_NAME +fi echo "Done! Your image(s) should be in deploy/"