Unmount the file system and detach an underlying memory disk even

if the script fails somewhere in the middle.

Prodded by:	phk
This commit is contained in:
Ruslan Ermilov 2003-03-31 12:29:31 +00:00
parent 0dbc5e389c
commit 51df6fdf37
2 changed files with 8 additions and 10 deletions

View File

@ -47,6 +47,8 @@ if [ ! -c /dev/${MDDEVICE} ] ; then
(cd /dev && sh MAKEDEV ${MDDEVICE})
fi
trap "umount ${MNT}; mdconfig -d -u ${MDDEVICE}" EXIT
EFI_SIZE=$((${FSSIZE}-68))
gpt create ${MDDEVICE}
@ -68,9 +70,5 @@ df -ki ${MNT}
set `df -ki ${MNT} | tail -1`
umount ${MNT}
mdconfig -d -u ${MDDEVICE} 2>/dev/null || true
echo "*** Filesystem is ${FSSIZE} K, $4 left"
echo "*** ${FSINODE} bytes/inode, $7 left"

View File

@ -58,6 +58,9 @@ dofs_vn () {
dd of=${FSIMG} if=/dev/zero count=${FSSIZE} bs=1k 2>/dev/null
vnconfig -s labels -c /dev/r${VNDEVICE} ${FSIMG}
trap "umount ${MNT}; vnconfig -u /dev/r${VNDEVICE}" EXIT
disklabel -w ${BOOT} ${VNDEVICE} ${FSLABEL}
newfs -i ${FSINODE} -o space -m 0 /dev/r${VNDEVICE}c
@ -73,9 +76,6 @@ dofs_vn () {
set `df -ki ${MNT} | tail -1`
umount ${MNT}
vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true
echo "*** Filesystem is ${FSSIZE} K, $4 left"
echo "*** ${FSINODE} bytes/inode, $7 left"
break;
@ -102,6 +102,9 @@ dofs_md () {
echo "No /dev/$MDDEVICE" 1>&2
exit 1
fi
trap "umount ${MNT}; mdconfig -d -u ${MDDEVICE}" EXIT
disklabel ${MACHINE} -w ${BOOT} ${MDDEVICE} ${FSLABEL}
newfs -i ${FSINODE} -o space -m 0 /dev/${MDDEVICE}c
@ -117,9 +120,6 @@ dofs_md () {
set `df -ki ${MNT} | tail -1`
umount ${MNT}
mdconfig -d -u ${MDDEVICE} 2>/dev/null || true
echo "*** Filesystem is ${FSSIZE} K, $4 left"
echo "*** ${FSINODE} bytes/inode, $7 left"
break;