summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandig <cpuidle@gmx.de>2018-03-05 16:35:11 +0100
committerXECDesign <XECDesign@users.noreply.github.com>2018-03-05 15:35:11 +0000
commitb4035400ffe7483935bd8afd5056616aa5d1c99a (patch)
tree2b7282e43cf367858c0201733520ca3c4dc3be28
parent4d689a25fdd2309e1c6c1b01d12523b3cd401461 (diff)
Add option to preserve build container (#160)
-rwxr-xr-xREADME.md6
-rwxr-xr-xbuild-docker.sh8
2 files changed, 13 insertions, 1 deletions
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: ( =<default> )
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/"