Skip to content

Commit b403540

Browse files
andigXECDesign
authored andcommitted
Add option to preserve build container (RPi-Distro#160)
1 parent 4d689a2 commit b403540

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ continue:
139139
CONTINUE=1 ./build-docker.sh
140140
```
141141

142+
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
143+
144+
```bash
145+
PRESERVE_CONTAINER=1 ./build-docker.sh
146+
```
147+
142148
There is a possibility that even when running from a docker container, the
143149
installation of `qemu-user-static` will silently fail when building the image
144150
because `binfmt-support` _must be enabled on the underlying kernel_. An easy

build-docker.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fi
2121

2222
CONTAINER_NAME=${CONTAINER_NAME:-pigen_work}
2323
CONTINUE=${CONTINUE:-0}
24+
PRESERVE_CONTAINER=${PRESERVE_CONTAINER:-0}
2425

2526
if [ "$*" != "" ] || [ -z "${IMG_NAME}" ]; then
2627
if [ -z "${IMG_NAME}" ]; then
@@ -33,6 +34,7 @@ Usage:
3334
Optional environment arguments: ( =<default> )
3435
CONTAINER_NAME=pigen_work set a name for the build container
3536
CONTINUE=1 continue from a previously started container
37+
PRESERVE_CONTAINER=1 keep build container even on successful build
3638
EOF
3739
exit 1
3840
fi
@@ -75,6 +77,10 @@ fi
7577
echo "copying results from deploy/"
7678
$DOCKER cp "${CONTAINER_NAME}":/pi-gen/deploy .
7779
ls -lah deploy
78-
$DOCKER rm -v $CONTAINER_NAME
80+
81+
# cleanup
82+
if [ "$PRESERVE_CONTAINER" != "1" ]; then
83+
$DOCKER rm -v $CONTAINER_NAME
84+
fi
7985

8086
echo "Done! Your image(s) should be in deploy/"

0 commit comments

Comments
 (0)