diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2019-10-19 13:14:24 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2019-10-19 13:14:24 +0000 |
commit | 0647a8191b1b64add344b7921a97303f1ad3c1ba (patch) | |
tree | 2329f743d5f0f5b69b18d78f7631e568e5217dca | |
parent | b48a5b6efb6c4529dbac9c6b3a844896a3bc98ca (diff) |
Determine the OS version in a way that won't break after 9.9.
Do it the same way in all three copies of the code.
Based on a patch from Chris Waddey.
with & ok ajacoutot
-rw-r--r-- | distrib/miniroot/install.sub | 4 | ||||
-rw-r--r-- | usr.sbin/syspatch/syspatch.sh | 4 | ||||
-rw-r--r-- | usr.sbin/sysupgrade/sysupgrade.sh | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 96c7e992fa8..b86df4f2628 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1144 2019/10/01 02:11:41 deraadt Exp $ +# $OpenBSD: install.sub,v 1.1145 2019/10/19 13:14:23 tb Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -2831,7 +2831,7 @@ finish_up() { # on the console and in the rc.firsttime output mail. isin "$ARCH" $_syspatch_archs && cat <<__EOT >>/mnt/etc/rc.firsttime set -A _KERNV -- \$(sysctl -n kern.version | - sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') + sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/;q') if ((\${#_KERNV[*]} == 1)) && [[ -s /etc/installurl ]] && _CKPATCH=\$(mktemp /tmp/_ckpatch.XXXXXXXXXX); then echo "Checking for available binary patches..." diff --git a/usr.sbin/syspatch/syspatch.sh b/usr.sbin/syspatch/syspatch.sh index fd895fd8049..1ef419037b1 100644 --- a/usr.sbin/syspatch/syspatch.sh +++ b/usr.sbin/syspatch/syspatch.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: syspatch.sh,v 1.151 2019/10/14 06:56:54 ajacoutot Exp $ +# $OpenBSD: syspatch.sh,v 1.152 2019/10/19 13:14:23 tb Exp $ # # Copyright (c) 2016, 2017 Antoine Jacoutot <ajacoutot@openbsd.org> # @@ -267,7 +267,7 @@ unpriv() # only run on release (not -current nor -stable) set -A _KERNV -- $(sysctl -n kern.version | - sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') + sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/;q') ((${#_KERNV[*]} > 1)) && sp_err "Unsupported release: ${_KERNV[0]}${_KERNV[1]}" [[ $@ == @(|-[[:alpha:]]) ]] || usage; [[ $@ == @(|-(c|R|r)) ]] && diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh index 5f0411376f3..1b228259ecd 100644 --- a/usr.sbin/sysupgrade/sysupgrade.sh +++ b/usr.sbin/sysupgrade/sysupgrade.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: sysupgrade.sh,v 1.26 2019/10/14 06:58:53 ajacoutot Exp $ +# $OpenBSD: sysupgrade.sh,v 1.27 2019/10/19 13:14:23 tb Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015 Robert Peichaer <rpe@openbsd.org> @@ -97,7 +97,7 @@ if $RELEASE && $SNAP; then fi set -A _KERNV -- $(sysctl -n kern.version | - sed 's/^OpenBSD \([0-9]\)\.\([0-9]\)\([^ ]*\).*/\1.\2 \3/;q') + sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/;q') shift $(( OPTIND -1 )) |