patches/sysupgrade-beta.diff

36 lines
1.2 KiB
Diff

Index: sysupgrade.sh
===================================================================
RCS file: /home/cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
retrieving revision 1.45
diff -u -p -u -p -r1.45 sysupgrade.sh
--- sysupgrade.sh 11 Feb 2022 12:58:18 -0000 1.45
+++ sysupgrade.sh 1 Mar 2022 08:50:40 -0000
@@ -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/^ 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)"