summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorMatthew Lear <matthew.lear@raspberrypi.com>2024-10-29 10:15:10 +0000
committerGitHub <noreply@github.com>2024-10-29 10:15:10 +0000
commitb8e497cf217402283b712af5be91c1384946429d (patch)
tree2c21adaa17004520cc8c6c0f2633c015ec3781f0 /build.sh
parent9dfbb1546db161697dcba1038aabebeb076b0942 (diff)
Allow export image customisation (#801)
* Allow export image customisation Add new variable EXPORT_CONFIG_DIR to set the location of the scripts pigen will run when exporting an image. Setting this is optional. If not specified, the current location is retained. By utilising STAGE_LIST AND EXPORT_CONFIG_DIR, a user can construct custom images out-of-tree without modification to any defaults. (cherry picked from commit e5e6ceeaf46f52f77b759d3d35aef8bbd0a69c8b) * Shellcheck and style fixes Fixed shellcheck warnings and made the changes more consistent with the surrounding code --------- Co-authored-by: Serge Schneider <serge@raspberrypi.com>
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index a96f4e4..4864dd6 100755
--- a/build.sh
+++ b/build.sh
@@ -301,6 +301,13 @@ log "Begin ${BASE_DIR}"
STAGE_LIST=${STAGE_LIST:-${BASE_DIR}/stage*}
export STAGE_LIST
+EXPORT_CONFIG_DIR=$(realpath "${EXPORT_CONFIG_DIR:-"${BASE_DIR}/export-image"}")
+if [ ! -d "${EXPORT_CONFIG_DIR}" ]; then
+ echo "EXPORT_CONFIG_DIR invalid: ${EXPORT_CONFIG_DIR} does not exist"
+ exit 1
+fi
+export EXPORT_CONFIG_DIR
+
for STAGE_DIR in $STAGE_LIST; do
STAGE_DIR=$(realpath "${STAGE_DIR}")
run_stage
@@ -308,7 +315,7 @@ done
CLEAN=1
for EXPORT_DIR in ${EXPORT_DIRS}; do
- STAGE_DIR=${BASE_DIR}/export-image
+ STAGE_DIR=${EXPORT_CONFIG_DIR}
# shellcheck source=/dev/null
source "${EXPORT_DIR}/EXPORT_IMAGE"
EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename "${EXPORT_DIR}")/rootfs