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 all else in there.
(I should've proposed it like this back in 2019 when I simplified the
 previous check.)

Clarify the comment how this is intentionally NOT logged, i.e. the test
happens before the error trap/syslog/logfile handling.

Feedback? OK?

NB: I was certain that we use a similar skip-if-on-NFS idiom elsewhere
    in our tree, but couldn't find it, so I probably misremember things.

Index: reorder_kernel.sh
===================================================================
RCS file: /cvs/src/libexec/reorder_kernel/reorder_kernel.sh,v
retrieving revision 1.12
diff -u -p -r1.12 reorder_kernel.sh
--- reorder_kernel.sh   7 Nov 2022 11:03:14 -0000       1.12
+++ reorder_kernel.sh   7 Nov 2022 14:12:26 -0000
@@ -20,15 +20,15 @@ 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
 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'

Reply via email to