Add early_customize_cmd() that allows to register custom functions run

before the build stage.

Reviewed by:	imp
Obtained from:	Netflix
This commit is contained in:
glebius 2016-04-04 21:06:44 +00:00
parent b1a0725ae4
commit 3c00d9092b
2 changed files with 30 additions and 0 deletions

View File

@ -83,6 +83,9 @@ NANO_KERNEL=GENERIC
# Use "default" to install all built modules.
NANO_MODULES=
# Early customize commands.
NANO_EARLY_CUSTOMIZE=""
# Customize commands.
NANO_CUSTOMIZE=""
@ -449,6 +452,22 @@ native_xtools ( ) (
) > ${NANO_LOG}/_.native_xtools 2>&1
)
#
# Run the requested set of early customization scripts, run before
# buildworld.
#
run_early_customize() {
pprint 2 "run early customize scripts"
for c in $NANO_EARLY_CUSTOMIZE
do
pprint 2 "early customize \"$c\""
pprint 3 "log: ${NANO_LOG}/_.early_cust.$c"
pprint 4 "`type $c`"
{ set -x ; $c ; set +x ; } >${NANO_LOG}/_.early_cust.$c 2>&1
done
}
#
# Run the requested set of customization scripts, run after we've
# done an installworld, installed the etc files, installed the kernel
@ -959,6 +978,15 @@ cust_pkgng ( ) (
rm -rf ${NANO_WORLDDIR}/Pkg
)
#######################################################################
# Convenience function:
# Register all args as early customize function to run just before
# build commences.
early_customize_cmd () {
NANO_EARLY_CUSTOMIZE="$NANO_EARLY_CUSTOMIZE $*"
}
#######################################################################
# Convenience function:
# Register all args as customize function.

View File

@ -139,6 +139,8 @@ fi
pprint 1 "NanoBSD image ${NANO_NAME} build starting"
run_early_customize
if $do_world ; then
if $do_clean ; then
clean_build