summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorthomas <thomas@FreeBSD.org>2004-08-16 22:46:58 +0000
committerthomas <thomas@FreeBSD.org>2004-08-16 22:46:58 +0000
commitefc85186f06a07dcadd5d6e69cdfe77a2a3e3398 (patch)
tree652a159b0fd46b8654ccda38b44f116970c4f762 /tools
parentfd87ccf13cea80d1870acd20fdc9af3e2b75d0da (diff)
downloadFreeBSD-src-efc85186f06a07dcadd5d6e69cdfe77a2a3e3398.zip
FreeBSD-src-efc85186f06a07dcadd5d6e69cdfe77a2a3e3398.tar.gz
Add example customization script, to be used through CUSTOMIZE Makefile knob.
Approved by: re (scottl)
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/nanobsd/customize.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/tools/tools/nanobsd/customize.sh b/tools/tools/nanobsd/customize.sh
new file mode 100644
index 0000000..5aa7974
--- /dev/null
+++ b/tools/tools/nanobsd/customize.sh
@@ -0,0 +1,72 @@
+#! /bin/sh
+#
+# Customize a nanoBSD flash image
+#
+# Copyright (c) 2004 Thomas Quinot
+#
+# See /usr/share/examples/etc/bsd-style-copyright for license terms.
+#
+# $FreeBSD$
+#
+# Usage:
+#
+# ${CUSTOMIZE} ${WD} ${WORLDDIR} ${.CURDIR} [ ${LOCAL_FILES_LIST} ]
+
+WD=$1
+WORLDDIR=$2
+CURDIR=$3
+LOCAL_FILES_LIST=$4
+
+PKG_DBDIR=${WD}/var/db/pkg
+export PKG_DBDIR
+
+# Useful stuff for diskless boot
+customizecfg() {
+ sed -i "" -e /beastie/d ${WD}/boot/loader.rc
+ sed -i "" -e /ttyd0/s/off/on/ ${WD}/etc/ttys
+ echo " -h" > ${WD}/boot.config
+}
+
+add_CURDIR() {
+ case "$1" in
+ /*) echo "$1" ;;
+ *) echo "${CURDIR}/$1" ;;
+ esac
+}
+
+pkg_relocate() {
+ sed -e "1,/^@cwd/s#^@cwd #&${WD}#"
+}
+
+installlocalfiles() {
+ if [ -n "${LOCAL_FILES_LIST}" ]; then
+ while read src dest;
+ do
+ case "x${src}" in
+ x#*|x)
+ ;;
+ x@*)
+ eval "for pkg in `add_CURDIR \"\`echo ${src} | sed 's/^@//'\`\"`;
+ do pkg_add -M \${pkg} | pkg_relocate | pkg_add -S;
+ done"
+ ;;
+ *)
+ dest="${dest:-${src}}"
+ mkdir -p ${WD}/`dirname "${dest}x"`
+ eval cp -fp `add_CURDIR ${src}` "${WD}/${dest}"
+ ;;
+ esac
+ done < ${LOCAL_FILES_LIST}
+ fi
+}
+
+movelocaletc() {
+ if [ ! -d ${WD}/etc/local ]; then
+ mv ${WD}/usr/local/etc ${WD}/etc/local
+ ln -s ../../etc/local ${WD}/usr/local/etc
+ fi
+}
+
+customizecfg
+installlocalfiles
+movelocaletc
OpenPOWER on IntegriCloud