1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 07:27:59 -08:00

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
This commit is contained in:
kn 2022-11-07 15:55:56 +00:00
parent ea243a6e63
commit f29e23ab45

View File

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