diff --git a/README.md b/README.md index 3e8964f..5dd22b8 100755 --- a/README.md +++ b/README.md @@ -73,6 +73,10 @@ The following environment variables are supported: Setting to '1' enables the QEMU mode - creating an image that can be mounted via QEMU for an emulated environment. These images include "-qemu" in the image file name. + * `LAST_STAGE` (Default: `"5"`) + + If you wish to build up to a specified stage (such as building up to stage 2 for a lite system) + * `RPI_LOCALHOST` (Default: `"raspberrypi"`) Your image hostname. @@ -233,6 +237,8 @@ maintenance and allows for more easy customization. ### Stage specification +If you wish to skip some steps you can add an empty file `SKIP` in the directory. +It works in `./stage*` or in `./stage*/**-whatever`. If you wish to build up to a specified stage (such as building up to stage 2 for a lite system), place an empty file named `SKIP` in each of the `./stage` directories you wish not to include. diff --git a/build.sh b/build.sh index 173a086..809d27a 100755 --- a/build.sh +++ b/build.sh @@ -133,6 +133,7 @@ if [ -z "${IMG_NAME}" ]; then fi export USE_QEMU="${USE_QEMU:-0}" +export LAST_STAGE=${LAST_STAGE:-5} export RPI_LOCALHOST=${RPI_LOCALHOST:-"raspberrypi"} export RPI_USERNAME=${RPI_USERNAME:-"pi"} export RPI_USERPASS=${RPI_USERPASS:-"raspberry"} @@ -174,14 +175,22 @@ export QUILT_REFRESH_ARGS="-p ab" source "${SCRIPT_DIR}/common" # shellcheck source=scripts/dependencies_check source "${SCRIPT_DIR}/dependencies_check" +mkdir -p "${WORK_DIR}" +# LAST_STAGE validation +if [[ "${LAST_STAGE,,}" =~ ^(2|4|5)$ ]]; then + log "Valid LAST_STAGE: $LAST_STAGE" +else + log "ERROR INVALID LAST_STAGE: $LAST_STAGE, try 2, 4 or 5" + exit 2 +fi dependencies_check "${BASE_DIR}/depends" -mkdir -p "${WORK_DIR}" log "Begin ${BASE_DIR}" -for STAGE_DIR in "${BASE_DIR}/stage"*; do +for i in $( seq 0 $LAST_STAGE); do + STAGE_DIR=${BASE_DIR}/stage$i run_stage done diff --git a/config.exemple b/config.exemple index 4c48c3c..d82e284 100644 --- a/config.exemple +++ b/config.exemple @@ -1,5 +1,6 @@ IMG_NAME="Raspbian" USE_QEMU=1 +LAST_STAGE=5 KEYBOARD_LANG="gb" RPI_LOCALHOST="raspberrypi" RPI_USERNAME="pi"