Skip to content

Commit

Permalink
Add option to preserve build container (RPi-Distro#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored and XECDesign committed Mar 5, 2018
1 parent 4d689a2 commit b403540
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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/"

0 comments on commit b403540

Please sign in to comment.