From 24ad8c2adb0cc28fb14f835531cf564cadf96866 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Tue, 11 Oct 2016 18:16:41 +0100 Subject: [PATCH] Revert 7f0c59d5c1291c087eccc4fc70014190de6a439f --- README.md | 12 ------------ build.sh | 43 +++++++++++++++++-------------------------- 2 files changed, 17 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 3318739..d3f8749 100644 --- a/README.md +++ b/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 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 diff --git a/build.sh b/build.sh index 8942314..c6abdae 100755 --- a/build.sh +++ b/build.sh @@ -88,22 +88,24 @@ run_stage(){ if [ -f ${STAGE_DIR}/EXPORT_IMAGE ]; then EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}" fi - if [ "${CLEAN}" = "1" ]; then - if [ -d ${ROOTFS_DIR} ]; then - rm -rf ${ROOTFS_DIR} + if [ ! -f SKIP ]; then + if [ "${CLEAN}" = "1" ]; then + if [ -d ${ROOTFS_DIR} ]; then + rm -rf ${ROOTFS_DIR} + fi fi - fi - if [ -x prerun.sh ]; then - log "Begin ${STAGE_DIR}/prerun.sh" - ./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 + if [ -x prerun.sh ]; then + log "Begin ${STAGE_DIR}/prerun.sh" + ./prerun.sh + log "End ${STAGE_DIR}/prerun.sh" 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} 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 + run_stage done CLEAN=1