summaryrefslogtreecommitdiff
path: root/libexec/reorder_kernel
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-11-07 15:55:57 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-11-07 15:55:57 +0000
commitb3cb1e245965459c8b322d49a2f23df56077edcb (patch)
tree08feb9d755c4ac0c45f3246c2d8336cde19ef466 /libexec/reorder_kernel
parent5dcbc9c943a3d20766db4293f7ed13e6e7e960e3 (diff)
Use variable and shorter logic for NFS check
No need to hardcode a parent path if we can reuse an existing variable for the specific path that is in being used. Negate the file system type in df(1) so the `|| exit 1' can be dropped in favour of the errexit option, as is done for everything else in there. Clarify the comment how this is intentionally NOT logged, i.e. the test happens before the error trap/syslog/logfile handling. OK millert
Diffstat (limited to 'libexec/reorder_kernel')
-rw-r--r--libexec/reorder_kernel/reorder_kernel.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/libexec/reorder_kernel/reorder_kernel.sh b/libexec/reorder_kernel/reorder_kernel.sh
index 4d89b40ead6..fb1d151f42a 100644
--- a/libexec/reorder_kernel/reorder_kernel.sh
+++ b/libexec/reorder_kernel/reorder_kernel.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: reorder_kernel.sh,v 1.12 2022/11/07 11:03:14 kn Exp $
+# $OpenBSD: reorder_kernel.sh,v 1.13 2022/11/07 15:55:56 kn Exp $
#
# Copyright (c) 2017 Robert Peichaer <rpe@openbsd.org>
#
@@ -20,9 +20,6 @@ set -o errexit
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
-# Skip if /usr/share is on a nfs mounted filesystem.
-df -t nfs /usr/share >/dev/null 2>&1 && exit 1
-
KERNEL=$(sysctl -n kern.osversion)
KERNEL=${KERNEL%#*}
KERNEL_DIR=/usr/share/relink/kernel
@@ -30,6 +27,9 @@ LOGFILE=$KERNEL_DIR/$KERNEL/relink.log
PROGNAME=${0##*/}
SHA256=/var/db/kernel.SHA256
+# Silently skip if on a NFS mounted filesystem.
+df -t nonfs $KERNEL_DIR >/dev/null 2>&1
+
# Install trap handlers to inform about success or failure via syslog.
ERRMSG='failed'
trap 'trap - EXIT; logger -st $PROGNAME "$ERRMSG" >/dev/console 2>&1' ERR