summaryrefslogtreecommitdiff
path: root/distrib/miniroot
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2002-07-18 00:36:45 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2002-07-18 00:36:45 +0000
commitd55fac72a21d8ae164b562032f9e4259f00f016d (patch)
tree5a888695fef355bdb82cef90cad80d4bd259e965 /distrib/miniroot
parent192ef022e06e39d0f2034dfcffabcca3742b4d78 (diff)
Rework upgrade's fstab handling so
1) All filesystem with a corresponding /sbin/mount_<type> available will be mounted. i.e. don't restrict automounting to ffs filesystems when the user can later mount the others manually. 2) All non-ffs filesystems will be mounted ro, just as currently is the case for user-mounted filesystems. 3) fsck all to-be-mounted filesystems that have a corresponding /sbin/fsck_<type> program present. Some verbiage adjustment and related code cleanup as well. ok deraadt@.
Diffstat (limited to 'distrib/miniroot')
-rw-r--r--distrib/miniroot/install.sub38
-rw-r--r--distrib/miniroot/upgrade.sh22
2 files changed, 36 insertions, 24 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 506b53649fe..659bf32a1cb 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.247 2002/07/13 16:32:13 krw Exp $
+# $OpenBSD: install.sub,v 1.248 2002/07/18 00:36:44 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback
@@ -1637,27 +1637,36 @@ munge_fstab() {
local _dev _mp _fstype _opt _rest
while read _dev _mp _fstype _opt _rest; do
- # Skip comment lines, non-ffs filesystems and
- # 'noauto' filesystems.
+ # Skip comment lines.
case $_dev in
\#*) continue ;;
esac
- case $_fstype in
- ffs) ;;
- *) continue ;;
- esac
+
+ # Skip noauto filesystems.
case $_opt in
*noauto*)
continue ;;
esac
- # Don't use soft updates
+ # Skip filesystems we can't mount.
+ [ -f "/sbin/mount_${_fstype}" ] || continue
+
+ # Remove any softdep options, as soft updates are not
+ # available in the ramdisk kernels.
_opt="$(echo ${_opt} | \
sed -e 's/^softdep$//; s/^softdep,//; s/,softdep,/,/; s/,softdep$//;')"
+ # Mount non-ffs filesystems read-only
+ [ "$_fstype" = "ffs" ] || \
+ _opt="$(echo ${_opt} | \
+ sed -e 's/^rw$/ro/; s/^rw,/ro,/; s/,rw,/,ro,/; s/,rw$/,ro/')"
+
+ # Avoid '/mnt/' in root fs entry in munged fstab
[ "$_mp" = "/" ] && _mp=
+ # Write fs entry in fstab.
echo $_dev /mnt$_mp $_fstype $_opt $_rest
+
done < /tmp/fstab > /etc/fstab
# If no /etc/fstab was created, we have nowhere to ${MODE} to.
@@ -1724,18 +1733,19 @@ remount_fs() {
done < /etc/fstab
}
-# Preen all filesystems in /etc/fstab, showing individual results,
-# but skipping the root filesystem device $ROOTDEV. This was
-# already fsck'ed successfully.
+# Preen all filesystems in /etc/fstab that have a /sbin/fsck_XXX,
+# showing individual results, but skipping $ROOTDEV. This was already
+# fsck'ed successfully.
#
# Exit if any fsck's fail (but do them all before exiting!).
check_fs() {
- local _dev _rest _fail
+ local _dev _mp _fstype _rest _badfsck=0 _root=$1
echo "Checking non-root filesystems..."
- while read _dev _rest; do
- [ "$_dev" = "/dev/$ROOTDEV" ] && continue
+ while read _dev _mp _fstype _rest; do
+ [ "$_dev" != "$_root" ] || continue
+ [ -f "/sbin/fsck_$_fstype" ] || continue
echo -n "fsck -p ${_dev}..."
if ! fsck -fp ${_dev} > /dev/null 2>&1; then
echo "FAILED. You must fsck this device manually."
diff --git a/distrib/miniroot/upgrade.sh b/distrib/miniroot/upgrade.sh
index f555ea34372..231ac331944 100644
--- a/distrib/miniroot/upgrade.sh
+++ b/distrib/miniroot/upgrade.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: upgrade.sh,v 1.38 2002/07/13 13:18:05 krw Exp $
+# $OpenBSD: upgrade.sh,v 1.39 2002/07/18 00:36:44 krw Exp $
# $NetBSD: upgrade.sh,v 1.2.4.5 1996/08/27 18:15:08 gwr Exp $
#
# Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback
@@ -132,19 +132,21 @@ __EOT
;;
esac
-echo "The fstab is configured as follows:\n"
-cat /tmp/fstab
-
cat << __EOT
+The fstab is configured as follows:
+
+$(</tmp/fstab)
+
+You may wish to edit the fstab before the filesystems are mounted. e.g. to
+change the order in which the filesystems are mounted.
-You may wish to edit the fstab. For example, you may need to resolve
-dependencies in the order which the filesystems are mounted.
+NOTE: 1) the edited fstab will be used only during the upgrade. It will not
+ be copied back into the root filesystem.
-NOTE: 1) this fstab is used only during the upgrade. It will not be
- copied into the root filesystem.
+ 2) Filesystems with a 'noauto' option or for which no /sbin/mount_XXX
+ can be found will not be mounted.
- 2) all non-ffs filesystems, and filesystems with the 'noauto'
- option, will be ignored during the upgrade.
+ 3) Non-ffs filesystems will be mounted read-only.
__EOT
ask "Edit the fstab with ${EDITOR}?" n