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).
This commit is contained in:
Philip Paeps 2005-07-25 08:40:13 +00:00
parent b35f2511fa
commit 1d22933171
4 changed files with 37 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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