summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrpe <rpe@openbsd.org>2017-01-26 04:34:51 +0000
committerrpe <rpe@openbsd.org>2017-01-26 04:34:51 +0000
commit9b64d5e06ef4c1f589a871e7f8ad633b03a1d677 (patch)
tree28ef94fcdf0fdc85685387eaf3577b457793ae0b
parentNo need to escape '.' in shell patterns - it has no special meaning. (diff)
downloadwireguard-openbsd-9b64d5e06ef4c1f589a871e7f8ad633b03a1d677.tar.xz
wireguard-openbsd-9b64d5e06ef4c1f589a871e7f8ad633b03a1d677.zip
Move setting _OSrev to immediately after verifying _KERNV and exit
early if _OSrev is empty. OK aja@
-rw-r--r--usr.sbin/syspatch/syspatch.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh
index 7f915b8730b..3251199cc40 100644
--- a/usr.sbin/syspatch/syspatch.sh
+++ b/usr.sbin/syspatch/syspatch.sh
@@ -1,6 +1,6 @@
#!/bin/ksh
#
-# $OpenBSD: syspatch.sh,v 1.88 2017/01/26 04:08:50 rpe Exp $
+# $OpenBSD: syspatch.sh,v 1.89 2017/01/26 04:34:51 rpe Exp $
#
# Copyright (c) 2016 Antoine Jacoutot <ajacoutot@openbsd.org>
#
@@ -270,13 +270,15 @@ set -A _KERNV -- $(sysctl -n kern.version |
sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q')
((${#_KERNV[*]} > 1)) && sp_err "Unsupported release ${_KERNV[*]}"
+_OSrev=${_KERNV[0]%.*}${_KERNV[0]#*.}
+[[ -n ${_OSrev} ]]
+
_MIRROR=$(while read _line; do _line=${_line%%#*}; [[ -n ${_line} ]] &&
print -r -- "${_line}"; done </etc/installurl | tail -1)
[[ -z ${_MIRROR} ]] && sp_err "${0##*/}: no URL configured in /etc/installurl"
_MIRROR="${_MIRROR}/syspatch/${_KERNV[0]}/$(machine)"
(($(sysctl -n hw.ncpufound) > 1)) && _BSDMP=true || _BSDMP=false
-_OSrev=${_KERNV[0]%.*}${_KERNV[0]#*.}
_PDIR="/var/syspatch"
_TMP=$(mktemp -d -p /tmp syspatch.XXXXXXXXXX)
@@ -285,7 +287,6 @@ readonly _BSDMP _KERNV _MIRROR _OSrev _PDIR _REL _TMP
trap 'set +e; rm -rf "${_TMP}"' EXIT
trap exit HUP INT TERM
-[[ -n ${_OSrev} ]]
while getopts clr arg; do
case ${arg} in