diff options
author | ru <ru@FreeBSD.org> | 2003-03-31 12:29:31 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2003-03-31 12:29:31 +0000 |
commit | e8c81cd0b97a8f1052bc052a294b947db3861e47 (patch) | |
tree | 1bc048f8158125d7eee872dc96b6e322af9f046b /release | |
parent | fa43c2f973280f8203411998257bcc92da926937 (diff) | |
download | FreeBSD-src-e8c81cd0b97a8f1052bc052a294b947db3861e47.zip FreeBSD-src-e8c81cd0b97a8f1052bc052a294b947db3861e47.tar.gz |
Unmount the file system and detach an underlying memory disk even
if the script fails somewhere in the middle.
Prodded by: phk
Diffstat (limited to 'release')
-rw-r--r-- | release/ia64/doFS.sh | 6 | ||||
-rw-r--r-- | release/scripts/doFS.sh | 12 |
2 files changed, 8 insertions, 10 deletions
diff --git a/release/ia64/doFS.sh b/release/ia64/doFS.sh index f75b724..054beeb 100644 --- a/release/ia64/doFS.sh +++ b/release/ia64/doFS.sh @@ -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" diff --git a/release/scripts/doFS.sh b/release/scripts/doFS.sh index 8d870fb..08d97a6 100644 --- a/release/scripts/doFS.sh +++ b/release/scripts/doFS.sh @@ -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; |