Add option to preserve build container (#160)

This commit is contained in:
andig 2018-03-05 16:35:11 +01:00 committed by XECDesign
parent 4d689a25fd
commit b4035400ff
2 changed files with 13 additions and 1 deletions

View File

@ -139,6 +139,12 @@ continue:
CONTINUE=1 ./build-docker.sh 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 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 installation of `qemu-user-static` will silently fail when building the image
because `binfmt-support` _must be enabled on the underlying kernel_. An easy because `binfmt-support` _must be enabled on the underlying kernel_. An easy

View File

@ -21,6 +21,7 @@ fi
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work} CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
CONTINUE=${CONTINUE:-0} CONTINUE=${CONTINUE:-0}
PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0}
if [ "$*" != "" ] || [ -z "${IMG_NAME}" ]; then if [ "$*" != "" ] || [ -z "${IMG_NAME}" ]; then
if [ -z "${IMG_NAME}" ]; then if [ -z "${IMG_NAME}" ]; then
@ -33,6 +34,7 @@ Usage:
Optional environment arguments: ( =<default> ) Optional environment arguments: ( =<default> )
CONTAINER_NAME=pigen_work set a name for the build container CONTAINER_NAME=pigen_work set a name for the build container
CONTINUE=1 continue from a previously started container CONTINUE=1 continue from a previously started container
PRESERVE_CONTAINER=1 keep build container even on successful build
EOF EOF
exit 1 exit 1
fi fi
@ -75,6 +77,10 @@ fi
echo "copying results from deploy/" echo "copying results from deploy/"
$DOCKER cp "${CONTAINER_NAME}":/pi-gen/deploy . $DOCKER cp "${CONTAINER_NAME}":/pi-gen/deploy .
ls -lah 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/" echo "Done! Your image(s) should be in deploy/"