This commit is contained in:
Serge Schneider 2016-10-11 18:16:41 +01:00
parent 017d3a4341
commit 24ad8c2adb
2 changed files with 17 additions and 38 deletions

View File

@ -27,18 +27,6 @@ The following environment variables are supported:
will not be included in the image, making it safe to use an `apt-cacher` or
similar package for development.
* `MAX_STAGE` (Default: unset)
Set this to the number of the highest stage you wish to build. For
Raspbian, `MAX_STAGE=2` will build Raspbian-lite and then stop.
* `RUN_STAGE` (Default: unset)
Build only a single stage. Does not build prior or subsequent stages.
Building with e.g. `RUN_STAGE=3` requires that a build of stage2 already
exists. *Note: Be aware that the image date affects whether or not the
prior stages will be found!*
A simple example for building Raspbian:
```bash

View File

@ -88,6 +88,7 @@ run_stage(){
if [ -f ${STAGE_DIR}/EXPORT_IMAGE ]; then
EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}"
fi
if [ ! -f SKIP ]; then
if [ "${CLEAN}" = "1" ]; then
if [ -d ${ROOTFS_DIR} ]; then
rm -rf ${ROOTFS_DIR}
@ -104,6 +105,7 @@ run_stage(){
run_sub_stage
fi
done
fi
unmount ${WORK_DIR}/${STAGE}
PREV_STAGE=${STAGE}
PREV_STAGE_DIR=${STAGE_DIR}
@ -126,12 +128,6 @@ if [ -z "${IMG_NAME}" ]; then
exit 1
fi
if [ -n "${RUN_STAGE}" ]; then
echo "Running ONLY stage${RUN_STAGE}"
elif [ -n "${MAX_STAGE}" ]; then
echo "Running stage${MAX_STAGE} build"
fi
export IMG_DATE=${IMG_DATE:-"$(date -u +%Y-%m-%d)"}
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@ -170,12 +166,7 @@ mkdir -p ${WORK_DIR}
log "Begin ${BASE_DIR}"
for STAGE_DIR in ${BASE_DIR}/stage*; do
STAGE_DIR_NUM=$(echo $STAGE_DIR | grep -o -E "[0-9]+$")
if [[ (-z $RUN_STAGE || $STAGE_DIR_NUM -eq $RUN_STAGE) && (-z $MAX_STAGE || $STAGE_DIR_NUM -le $MAX_STAGE) ]]; then
run_stage
else
echo "Skipping ${STAGE_DIR}"
fi
done
CLEAN=1