summaryrefslogtreecommitdiff
path: root/etc/rc
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2019-02-19 20:41:53 +0000
committerkn <kn@cvs.openbsd.org>2019-02-19 20:41:53 +0000
commitd9e83120633f682e2bc47a59a47d689c79465db6 (patch)
treee0f12cf0f9228759602346436d33993be3a50bfc /etc/rc
parent0682d99e129e975f649676a012f977d9b8db5312 (diff)
Simplify NFS check in reorder_libs()
Loop over df(1)'s output directly, ensure the resulting list of block devices is unique to avoid later duplicity checks and redundant mount(8) invocations. This allows direct bail out on invalid types and simpler saving for later remount. OK deraadt
Diffstat (limited to 'etc/rc')
-rw-r--r--etc/rc14
1 files changed, 6 insertions, 8 deletions
diff --git a/etc/rc b/etc/rc
index 6788879ca9f..eab4aca0a8e 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.532 2019/01/26 10:59:07 florian Exp $
+# $OpenBSD: rc,v 1.533 2019/02/19 20:41:52 kn Exp $
# System startup script run by init on autoboot or after single-user.
# Output and error are redirected to console by init, and the console is the
@@ -175,13 +175,11 @@ reorder_libs() {
# Skip if /usr/lib, /usr/libexec or /usr/share/relink are on nfs mounted
# filesystems, otherwise record which ones are mounted read-only.
- for _d in /usr/{lib,libexec,share/relink}; do
- _dkdev=$(df $_d | sed '1d;s/ .*//')
- _mp=$(mount | grep "^$_dkdev")
- [[ $_mp == *" type nfs "* ]] && return
- if [[ $_mp == *" type ffs "*"read-only"* &&
- $_ro_list != *${_mp%% *}* ]]; then
- _ro_list="$_ro_list ${_mp%% *}"
+ for _dkdev in $(df /usr/{lib,libexec} $_relink |
+ sed '1d;s/ .*//' | sort -u); do
+ _mp=$(mount -t ffs | grep "^$_dkdev") || return
+ if [[ $_mp == *read-only* ]]; then
+ _ro_list="$_ro_list ${_mp%% *}"
fi
done