Browse Source

Revert 7f0c59d5c1

pull/29/head
Serge Schneider 5 years ago
parent
commit
24ad8c2adb
2 changed files with 17 additions and 38 deletions
  1. +0
    -12
      README.md
  2. +17
    -26
      build.sh

+ 0
- 12
README.md 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

+ 17
- 26
build.sh View File

@ -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

Loading…
Cancel
Save