From: kn Date: Mon, 7 Nov 2022 15:55:56 +0000 (+0000) Subject: Use variable and shorter logic for NFS check X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f29e23ab45096ade979f325832e63330dcd2984a;p=openbsd 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 --- 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 # @@ -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