From: sdk Date: Thu, 3 Mar 2022 10:12:08 +0000 (+0000) Subject: Pick correct firmware directory. Read the target kernel version and use X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=996cf3d1fb3f86968a4b2546bfe6f3ef7fd0883c;p=openbsd Pick correct firmware directory. Read the target kernel version and use the release directory for everything except -current. OK afresh1@ --- diff --git a/usr.sbin/sysupgrade/sysupgrade.sh b/usr.sbin/sysupgrade/sysupgrade.sh index 7297bb535e2..f9bd572979f 100644 --- a/usr.sbin/sysupgrade/sysupgrade.sh +++ b/usr.sbin/sysupgrade/sysupgrade.sh @@ -1,6 +1,6 @@ #!/bin/ksh # -# $OpenBSD: sysupgrade.sh,v 1.45 2022/02/11 12:58:18 florian Exp $ +# $OpenBSD: sysupgrade.sh,v 1.46 2022/03/03 10:12:08 sdk Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015 Robert Peichaer @@ -123,10 +123,8 @@ fi if $SNAP; then URL=${MIRROR}/snapshots/${ARCH}/ - FW_URL=http://firmware.openbsd.org/firmware/snapshots/ else URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/ - FW_URL=http://firmware.openbsd.org/firmware/${NEXT_VERSION}/ fi install -d -o 0 -g 0 -m 0755 ${SETSDIR} @@ -196,7 +194,15 @@ __EOT fi echo Fetching updated firmware. -fw_update -p ${FW_URL} || true +set -A _NEXTKERNV -- $(what bsd | + sed -n '2s/^[[:blank:]]OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/p') + +if [[ ${_NEXTKERNV[1]} == '-current' ]]; then + FW_URL=http://firmware.openbsd.org/firmware/snapshots/ +else + FW_URL=http://firmware.openbsd.org/firmware/${_NEXTKERNV[0]}/ +fi +VNAME="${_NEXTKERNV[0]}" fw_update -p ${FW_URL} || true install -F -m 700 bsd.rd /bsd.upgrade logger -t sysupgrade -p kern.info "installed new /bsd.upgrade. Old kernel version: $(sysctl -n kern.version)"