Browse Source

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
OPENBSD_6_5
kn 5 years ago
parent
commit
eec686b45b
1 changed files with 6 additions and 8 deletions
  1. +6
    -8
      src/etc/rc

+ 6
- 8
src/etc/rc View File

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


Loading…
Cancel
Save