From ec94057268d9ecaa931cb1c96f4fc0cdfcc02375 Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 15 Jun 2010 18:18:31 +0000 Subject: Allow population of /cfg and /data. Begin the move to making all slice creation overrideable too, but there's a few problems doing that for the duplicated partitions (s1 and s2), so just comment that it needs work. MFC after: 3 days --- tools/tools/nanobsd/nanobsd.sh | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/tools/nanobsd/nanobsd.sh b/tools/tools/nanobsd/nanobsd.sh index e6062bb..811c58b 100644 --- a/tools/tools/nanobsd/nanobsd.sh +++ b/tools/tools/nanobsd/nanobsd.sh @@ -357,6 +357,30 @@ prune_usr() ( done ) +populate_slice ( ) ( + local dev dir mnt + dev=$1 + dir=$2 + mnt=$3 + test -z $2 && dir=/var/empty + test -d $d || dir=/var/empty + echo "Creating ${dev} with ${dir} (mounting on ${mnt})" + newfs ${NANO_NEWFS} ${dev} + mount ${dev} ${mnt} + cd ${dir} + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt} + df -i ${mnt} + umount ${mnt} +) + +populate_cfg_slice ( ) ( + populate_slice "$1" "$2" "$3" +) + +populate_data_slice ( ) ( + populate_slice "$1" "$2" "$3" +) + create_i386_diskimage ( ) ( pprint 2 "build diskimage" pprint 3 "log: ${NANO_OBJ}/_.di" @@ -456,6 +480,7 @@ create_i386_diskimage ( ) ( bsdlabel ${MD}s1 # Create first image + # XXX: should use populate_slice for easier override newfs ${NANO_NEWFS} /dev/${MD}s1a mount /dev/${MD}s1a ${MNT} df -i ${MNT} @@ -480,13 +505,11 @@ create_i386_diskimage ( ) ( fi # Create Config slice - newfs ${NANO_NEWFS} /dev/${MD}s3 - # XXX: fill from where ? + populate_cfg_slice /dev/${MD}s3 "${NANO_CFGDIR}" ${MNT} # Create Data slice, if any. if [ $NANO_DATASIZE -ne 0 ] ; then - newfs ${NANO_NEWFS} /dev/${MD}s4 - # XXX: fill from where ? + populate_data_slice /dev/${MD}s4 "${NANO_DATADIR}" ${MNT} fi if [ "${NANO_MD_BACKING}" = "swap" ] ; then -- cgit v1.1