diff options
author | phk <phk@FreeBSD.org> | 2007-06-12 11:35:29 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2007-06-12 11:35:29 +0000 |
commit | 36ecaa8cd6cf4939ee6d5692193c12bf400fcbf6 (patch) | |
tree | 9d1cc721f65b188fdbbed8eb4a1e280944cd0a67 /tools/tools | |
parent | 1cd5c5dd060ed74ed2778ad4f459ed32f0ad4a8a (diff) | |
download | FreeBSD-src-36ecaa8cd6cf4939ee6d5692193c12bf400fcbf6.zip FreeBSD-src-36ecaa8cd6cf4939ee6d5692193c12bf400fcbf6.tar.gz |
Add cust_pkg() which iteratively tries to install packages.
Move /usr/local/etc to /etc/local so that installed packages can be frobbed.
Use a more compatible 512MB card geometry.
Diffstat (limited to 'tools/tools')
-rw-r--r-- | tools/tools/nanobsd/nanobsd.sh | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh index 42e6e26..549f4d6 100644 --- a/tools/tools/nanobsd/nanobsd.sh +++ b/tools/tools/nanobsd/nanobsd.sh @@ -45,6 +45,9 @@ NANO_SRC=/usr/src # Where nanobsd additional files live under the source tree NANO_TOOLS=tools/tools/nanobsd +# Where cust_pkg() finds packages to install +NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg + # Object tree directory # default is subdir of /usr/obj # XXX: MAKEOBJDIRPREFIX handling... ? @@ -75,7 +78,7 @@ NANO_NEWFS="-b 4096 -f 512 -i 8192 -O1 -U" NANO_DRIVE=ad0 # Target media size in 512 bytes sectors -NANO_MEDIASIZE=1048576 +NANO_MEDIASIZE=1000000 # Number of code images on media (1 or 2) NANO_IMAGES=2 @@ -100,7 +103,7 @@ NANO_RAM_ETCSIZE=10240 NANO_RAM_TMPVARSIZE=10240 # Media geometry, only relevant if bios doesn't understand LBA. -NANO_SECTS=32 +NANO_SECTS=63 NANO_HEADS=16 # boot0 flags/options and configuration @@ -232,6 +235,20 @@ setup_nanobsd ( ) ( ( cd ${NANO_WORLDDIR} + # Move /usr/local/etc to /etc/local so that the /cfg stuff + # can stomp on it. Otherwise packages like ipsec-tools which + # have hardcoded paths under ${prefix}/etc are not tweakable. + if [ -d usr/local/etc ] ; then + ( + mkdir etc/local + cd usr/local/etc + find . -print | cpio -dumpl ../../../etc/local + cd .. + rm -rf etc + ln -s ../../etc/local etc + ) + fi + for d in var etc do # link /$d under /conf @@ -470,6 +487,46 @@ cust_install_files () ( ) ####################################################################### +# Install packages from ${NANO_PACKAGE_DIR} + +cust_pkg () ( + + # Copy packages into chroot + mkdir -p ${NANO_WORLDDIR}/Pkg + cp ${NANO_PACKAGE_DIR}/* ${NANO_WORLDDIR}/Pkg + + # Count & report how many we have to install + todo=`ls ${NANO_WORLDDIR}/Pkg | wc -l` + echo "=== TODO: $todo" + ls ${NANO_WORLDDIR}/Pkg + echo "===" + while true + do + # Record how may we have now + have=`ls ${NANO_WORLDDIR}/var/db/pkg | wc -l` + + # Attempt to install more + chroot ${NANO_WORLDDIR} sh -c 'pkg_add -F Pkg/*' || true + + # See what that got us + now=`ls ${NANO_WORLDDIR}/var/db/pkg | wc -l` + echo "=== NOW $now" + ls ${NANO_WORLDDIR}/var/db/pkg + echo "===" + + + if [ $now -eq $todo ] ; then + echo "DONE $now packages" + break + elif [ $now -eq $have ] ; then + echo "FAILED: Nothing happened on this pass" + exit 2 + fi + done + rm -rf ${NANO_WORLDDIR}/Pkg +) + +####################################################################### # Convenience function: # Register $1 as customize function. |