On Tue, Mar 01, 2022 at 10:06:10AM +0100, Stefan Hagen wrote: > Stefan Hagen wrote (2022-02-28 22:16 CET): > > Theo de Raadt wrote (2022-02-28 18:02 CET): > > > When you run sysupgrade, you want the firmwares matching what you are > > > installing. > > > > > > The system you are running right now is irrelevant. It's drivers > > > have already loaded the firmwares they need, and a reboot into new > > > bsd.rd is about to happen. > > > > > > So why does there continue to be conversation about the current > > > system release? It is irrelevant. > > > > Good point. This diff should be better then. It's not trying to reuse > > NEXT_VERSION or _KERN based on beta/current tag guesswork, but gets > > all information from the target kernel. > > > > If config -ao should not be used, here a version with what(1): > > Again with correct amount of [ and ] and the use of what(1) with the sed > tips from Leon. > > I tested: > Upgrade 69 -> 70 > Upgrade 70 -> 71-beta > Upgrade 70-current -> 71-beta > Upgrade 71-beta -> 71-beta > > It did the right thing in all those cases. > > OK?
This looks pretty much like what I came up with, although I used [[:blank]] similarly to what sthen@ suggested, but either way. OK afresh1@ > > Best Regards, > Stefan > > 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)" > -- andrew If your computer says, "Printer out of Paper," this problem cannot be resolved by continuously clicking the "OK" button.