Revert 7f0c59d5c1
This commit is contained in:
parent
017d3a4341
commit
24ad8c2adb
2 changed files with 17 additions and 38 deletions
12
README.md
12
README.md
|
@ -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
|
will not be included in the image, making it safe to use an `apt-cacher` or
|
||||||
similar package for development.
|
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:
|
A simple example for building Raspbian:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
43
build.sh
43
build.sh
|
@ -88,22 +88,24 @@ run_stage(){
|
||||||
if [ -f ${STAGE_DIR}/EXPORT_IMAGE ]; then
|
if [ -f ${STAGE_DIR}/EXPORT_IMAGE ]; then
|
||||||
EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}"
|
EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}"
|
||||||
fi
|
fi
|
||||||
if [ "${CLEAN}" = "1" ]; then
|
if [ ! -f SKIP ]; then
|
||||||
if [ -d ${ROOTFS_DIR} ]; then
|
if [ "${CLEAN}" = "1" ]; then
|
||||||
rm -rf ${ROOTFS_DIR}
|
if [ -d ${ROOTFS_DIR} ]; then
|
||||||
|
rm -rf ${ROOTFS_DIR}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
if [ -x prerun.sh ]; then
|
||||||
if [ -x prerun.sh ]; then
|
log "Begin ${STAGE_DIR}/prerun.sh"
|
||||||
log "Begin ${STAGE_DIR}/prerun.sh"
|
./prerun.sh
|
||||||
./prerun.sh
|
log "End ${STAGE_DIR}/prerun.sh"
|
||||||
log "End ${STAGE_DIR}/prerun.sh"
|
|
||||||
fi
|
|
||||||
for SUB_STAGE_DIR in ${STAGE_DIR}/*; do
|
|
||||||
if [ -d ${SUB_STAGE_DIR} ] &&
|
|
||||||
[ ! -f ${SUB_STAGE_DIR}/SKIP ]; then
|
|
||||||
run_sub_stage
|
|
||||||
fi
|
fi
|
||||||
done
|
for SUB_STAGE_DIR in ${STAGE_DIR}/*; do
|
||||||
|
if [ -d ${SUB_STAGE_DIR} ] &&
|
||||||
|
[ ! -f ${SUB_STAGE_DIR}/SKIP ]; then
|
||||||
|
run_sub_stage
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
unmount ${WORK_DIR}/${STAGE}
|
unmount ${WORK_DIR}/${STAGE}
|
||||||
PREV_STAGE=${STAGE}
|
PREV_STAGE=${STAGE}
|
||||||
PREV_STAGE_DIR=${STAGE_DIR}
|
PREV_STAGE_DIR=${STAGE_DIR}
|
||||||
|
@ -126,12 +128,6 @@ if [ -z "${IMG_NAME}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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 IMG_DATE=${IMG_DATE:-"$(date -u +%Y-%m-%d)"}
|
||||||
|
|
||||||
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
@ -170,12 +166,7 @@ mkdir -p ${WORK_DIR}
|
||||||
log "Begin ${BASE_DIR}"
|
log "Begin ${BASE_DIR}"
|
||||||
|
|
||||||
for STAGE_DIR in ${BASE_DIR}/stage*; do
|
for STAGE_DIR in ${BASE_DIR}/stage*; do
|
||||||
STAGE_DIR_NUM=$(echo $STAGE_DIR | grep -o -E "[0-9]+$")
|
run_stage
|
||||||
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
|
done
|
||||||
|
|
||||||
CLEAN=1
|
CLEAN=1
|
||||||
|
|
Loading…
Reference in a new issue