Selection for the last stage to build

This commit is contained in:
Jacen 2017-09-12 22:11:07 +02:00
parent 496e41575e
commit cf3dc88155
2 changed files with 17 additions and 20 deletions

View File

@ -66,6 +66,10 @@ The following environment variables are supported:
Output directory for target system images and NOOBS bundles.
* `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)
A simple example for building Raspbian:
@ -155,21 +159,5 @@ maintenance and allows for more easy customization.
### Stage specification
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.
Then remove the `EXPORT*` files from `./stage4` (if building up to stage 2) or
from `./stage2` (if building a minimal system).
```bash
# Example for building a lite system
echo "IMG_NAME='Raspbian'" > config
touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP
rm stage4/EXPORT* stage5/EXPORT*
sudo ./build.sh # or ./build-docker.sh
```
If you wish to build further configurations upon (for example) the lite
system, you can also delete the contents of `./stage3` and `./stage4` and
replace with your own contents in the same format.
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`.

View File

@ -128,6 +128,7 @@ if [ -z "${IMG_NAME}" ]; then
exit 1
fi
export LAST_STAGE=${LAST_STAGE:-5}
export IMG_DATE=${IMG_DATE:-"$(date +%Y-%m-%d)"}
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@ -160,14 +161,22 @@ export QUILT_REFRESH_ARGS="-p ab"
source ${SCRIPT_DIR}/common
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