Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Apr 2016 21:06:44 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297564 - head/tools/tools/nanobsd
Message-ID:  <201604042106.u34L6ivX014440@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Apr  4 21:06:44 2016
New Revision: 297564
URL: https://svnweb.freebsd.org/changeset/base/297564

Log:
  Add early_customize_cmd() that allows to register custom functions run
  before the build stage.
  
  Reviewed by:	imp
  Obtained from:	Netflix

Modified:
  head/tools/tools/nanobsd/defaults.sh
  head/tools/tools/nanobsd/nanobsd.sh

Modified: head/tools/tools/nanobsd/defaults.sh
==============================================================================
--- head/tools/tools/nanobsd/defaults.sh	Mon Apr  4 20:33:16 2016	(r297563)
+++ head/tools/tools/nanobsd/defaults.sh	Mon Apr  4 21:06:44 2016	(r297564)
@@ -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=""
 
@@ -450,6 +453,22 @@ native_xtools ( ) (
 )
 
 #
+# 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
 # and tweaked them in the standard way.
@@ -961,6 +980,15 @@ cust_pkgng ( ) (
 
 #######################################################################
 # 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.
 
 customize_cmd ( ) {

Modified: head/tools/tools/nanobsd/nanobsd.sh
==============================================================================
--- head/tools/tools/nanobsd/nanobsd.sh	Mon Apr  4 20:33:16 2016	(r297563)
+++ head/tools/tools/nanobsd/nanobsd.sh	Mon Apr  4 21:06:44 2016	(r297564)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604042106.u34L6ivX014440>