bin/70795: [PATCH] misc nanobsd fixes and improvements

Andrea Campi andrea+freebsd at webcom.it
Sat Aug 21 12:00:38 PDT 2004


>Number:         70795
>Category:       bin
>Synopsis:       [PATCH] misc nanobsd fixes and improvements
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 21 19:00:36 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Andrea Campi
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD brian 5.2-CURRENT FreeBSD 5.2-CURRENT #4: Thu Aug 19 08:28:23 CEST 2004 andrea at brian:/usr/obj/usr/src/sys/THINKPAD i386


>Description:
There are a few minor issues with src/tools/tools/nanobsd:

 - Makefile: we remove ${WD}/var and recreate it empty from mtree. This gets
in the way in multiple ways; even worse, it deletes any work done in the
Customize stage. I propose to just copy it the way we do for ${WD}/etc.

 - customize.sh: I propose to create a /boot/loader.conf file to make the boot
shorter.

 - i386.diskimage: CFGMASTER is assigned the $10 variable, but that is
interpreted by the shell as ${1}0; fix it by properly quoting.
make_fstab() creates an /etc/fstab file in the wrong place.

> ow-To-Repeat:
>How-To-Repeat:
>Fix:

Apply following patch:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff -ur ./Makefile good/Makefile
--- ./Makefile  Mon Aug 16 22:41:58 2004
+++ good/Makefile       Sat Aug 21 18:35:43 2004
@@ -144,11 +144,11 @@
 _.md:  _.cs
        -umount ${WD}/dev > /dev/null 2>&1
        chflags -R noschg ${WD} > /dev/null 2>&1
-       rm -rf ${WD}/var/* ${WD}/dev/* ${WD}/tmp
+       rm -rf ${WD}/dev/* ${WD}/tmp
        # create trigger file for etc/rc.d/initdiskless
        touch ${WD}/etc/diskless
        mkdir -p ${WD}/conf/base/var
-       mtree -deU -f ${WD}/etc/mtree/BSD.var.dist -p ${WD}/conf/base/var
+       ( cd ${WD}/var && find . -print | cpio -dumpl ../conf/base/var )
        mkdir -p ${WD}/conf/base/etc
        ( cd ${WD}/etc && find . -print | cpio -dumpl ../conf/base/etc )
        mkdir -p ${WD}/conf/default/etc
diff -ur ./customize.sh good/customize.sh
--- ./customize.sh      Mon Aug 16 22:46:58 2004
+++ good/customize.sh   Sat Aug 21 18:32:45 2004
@@ -25,6 +25,7 @@
   sed -i "" -e /beastie/d ${WD}/boot/loader.rc
   sed -i "" -e /ttyd0/s/off/on/ ${WD}/etc/ttys
   echo " -h" > ${WD}/boot.config
+  echo 'autoboot_delay="1"' > ${WD}/boot/loader.conf
 }
 
 add_CURDIR() {
diff -ur ./i386.diskimage good/i386.diskimage
--- ./i386.diskimage    Mon Aug 16 22:41:58 2004
+++ good/i386.diskimage Sat Aug 21 18:42:40 2004
@@ -25,14 +25,14 @@
 CFGSLICE=$7
 WD=$8
 IMG=$9
-CFGMASTER=$10
+CFGMASTER=${10}
 
 TMPFILE0=`mktemp -t nanobsd`
 TMPFILE1=`mktemp -t nanobsd`
 TMPMNT=`mktemp -d -t nanobsd`
 
 make_fstab () {
-  echo "/dev/$1 / ufs ro 1 1" > ${WD}/etc/fstab
+  echo "/dev/$1 / ufs ro 1 1" > $2/etc/fstab
 }
 
 get_label () {
@@ -75,7 +75,7 @@
 newfs ${PRIROOTLABEL} -O1 -U ${MD}s1a
 mount /dev/${MD}s1a ${TMPMNT}
 (cd ${WD} && find . -print | cpio -dump ${TMPMNT}) || true
-make_fstab ${PRIROOTSLICE}
+make_fstab ${PRIROOTSLICE} ${TMPMNT}
 df ${TMPMNT}
 umount ${TMPMNT}
 
@@ -86,7 +86,7 @@
   tunefs ${ALTROOTLABEL} /dev/${MD}s2a
 fi
 mount /dev/${MD}s2a ${TMPMNT}
-make_fstab ${ALTROOTSLICE}
+make_fstab ${ALTROOTSLICE} ${TMPMNT}
 umount ${TMPMNT}
 
 # Prepare configuration slice
diff -ur ./localfiles good/localfiles
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Bye,
	Andrea
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list