diff options
author | philip <philip@FreeBSD.org> | 2005-07-25 08:40:13 +0000 |
---|---|---|
committer | philip <philip@FreeBSD.org> | 2005-07-25 08:40:13 +0000 |
commit | f6a2d54d4e1d261864af5edc92e8d460f5900937 (patch) | |
tree | 69caf1d1295b51192f04ee539b2f26bdb2843e5f /tools | |
parent | 1384eaf756f485ea32115bc2fd29781c9d34b6ae (diff) | |
download | FreeBSD-src-f6a2d54d4e1d261864af5edc92e8d460f5900937.zip FreeBSD-src-f6a2d54d4e1d261864af5edc92e8d460f5900937.tar.gz |
Add fstab entries for ALTROOTSLICE and CFGSLICE, allowing us to do away with
most of the hardcoding of device names in installed convenience scripts.
Provide a new script (root/updatep) to easily update the ALTROOTSLICE. It
does the same as updatep1/updatep2 without hardcoded device names. If noone
protests, I'd like to get rid of updatep1/updatep2 at some point.
As an extra bonus: turn on the error led while updating (on hardware with a
led).
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/nanobsd/Files/root/change_password | 4 | ||||
-rw-r--r-- | tools/tools/nanobsd/Files/root/save_sshkeys | 4 | ||||
-rw-r--r-- | tools/tools/nanobsd/Files/root/updatep | 25 | ||||
-rw-r--r-- | tools/tools/nanobsd/i386.diskimage | 10 |
4 files changed, 37 insertions, 6 deletions
diff --git a/tools/tools/nanobsd/Files/root/change_password b/tools/tools/nanobsd/Files/root/change_password index aae27f5c..17ac794 100644 --- a/tools/tools/nanobsd/Files/root/change_password +++ b/tools/tools/nanobsd/Files/root/change_password @@ -10,6 +10,8 @@ set -ex passwd root -mount /dev/ad0s3 /mnt +cfgslice=`grep '/cfg' /etc/fstab | cut -d \ -f 1` + +mount -o rw $cfgslice /mnt cp /etc/master.passwd /etc/passwd /etc/pwd.db /etc/spwd.db /etc/group /mnt umount /mnt diff --git a/tools/tools/nanobsd/Files/root/save_sshkeys b/tools/tools/nanobsd/Files/root/save_sshkeys index 19bb8cd..609fa29 100644 --- a/tools/tools/nanobsd/Files/root/save_sshkeys +++ b/tools/tools/nanobsd/Files/root/save_sshkeys @@ -8,7 +8,9 @@ set -ex -mount /dev/ad0s3 /mnt +cfgslice=`grep '/cfg' /etc/fstab | cut -d \ -f 1` + +mount -o rw $cfgslice /mnt mkdir -p /mnt/ssh ( cd /etc/ssh diff --git a/tools/tools/nanobsd/Files/root/updatep b/tools/tools/nanobsd/Files/root/updatep new file mode 100644 index 0000000..b308cc9 --- /dev/null +++ b/tools/tools/nanobsd/Files/root/updatep @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Script to update the ALTROOTSLICE on NanoBSD systems. +# +# usage: +# mdconfig -a -t vnode -f _.i.s1 +# ssh somewhere sh updatep < /dev/md0a +# mdconfig -d -u 0 +# + +set -e + +altslice=`grep /alt /etc/fstab | cut -d \ -f 1` + +if mount | grep $altslice > /dev/null ; then + echo "You have $altslice mounted, unmount it first" + exit 1 +fi + +(echo 1 >/dev/led/error) 2>/dev/null || true +dd of=$altslice obs=64k +boot0cfg -s 1 -v ad0 +(echo 0 >/dev/led/error) 2>/dev/null || true diff --git a/tools/tools/nanobsd/i386.diskimage b/tools/tools/nanobsd/i386.diskimage index 678db72..f722e45 100644 --- a/tools/tools/nanobsd/i386.diskimage +++ b/tools/tools/nanobsd/i386.diskimage @@ -34,8 +34,10 @@ TMPFILE1=`mktemp -t nanobsd` TMPMNT=`mktemp -d -t nanobsd` make_fstab () { - echo "/dev/$1 / ufs ro 1 1" > $2/etc/fstab - ln -f $2/etc/fstab $2/conf/base/etc/fstab + echo "/dev/$1 / ufs ro 1 1" > $4/etc/fstab + echo "/dev/$2 /alt ufs ro,noauto 1 1" >> $4/etc/fstab + echo "/dev/$3 /cfg ufs ro,noauto 1 1" >> $4/etc/fstab + ln -f $4/etc/fstab $4/conf/base/etc/fstab } get_label () { @@ -89,7 +91,7 @@ bsdlabel -w -B ${MD}s1 newfs ${NEWFSPARAM} ${PRIROOTLABEL} -O1 -U ${MD}s1a mount /dev/${MD}s1a ${TMPMNT} (cd ${WD} && find . -print | cpio -dump ${TMPMNT}) || true -make_fstab ${PRIROOTSLICE} ${TMPMNT} +make_fstab ${PRIROOTSLICE} ${ALTROOTSLICE} ${CFGSLICE} ${TMPMNT} df -i ${TMPMNT} umount ${TMPMNT} @@ -100,7 +102,7 @@ if [ -n "${ALTROOTLABEL}" ]; then tunefs ${ALTROOTLABEL} /dev/${MD}s2a fi mount /dev/${MD}s2a ${TMPMNT} -make_fstab ${ALTROOTSLICE} ${TMPMNT} +make_fstab ${ALTROOTSLICE} ${PRIROOTSLICE} ${CFGSLICE} ${TMPMNT} umount ${TMPMNT} # Prepare configuration slice |