On Mon, Feb 28, 2022 at 08:27:13AM +0100, Florian Obser wrote:
> On 2022-02-27 21:33 -08, Andrew Hewus Fresh 
> <afre...@zarniwoop.home.hewus.com> wrote:
> > So, sdk@ noticed that sysupgrade didn't get updated for the new logic in
> > the firmware directories.  Specifically that the only time we use
> > "snapshots" directory is with -current.  The rest of the time, including
> > during -beta we use the version directory.  This diff should handle that
> > case, installing the correct firmware for the system we are about to
> > install.
> >
> > This also uses a secret feature of fw_update(8) where if you set "VNAME"
> > in the environment, it uses that instead of asking sysctl to calculate
> > the name of the signify key to use.   Probably that could use an
> > improvement, maybe trusting the untrusted comment at the top of the
> > file..
> >
> > I'm not sure if there's a better way to find the version string from a
> > bsd kernel, so I used the one I knew about.
> 
> I think you can just look at _KERNV which is populated thusly:
> 
> 
>     98        set -A _KERNV -- $(sysctl -n kern.version |
>     99                sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 
> \2/;q')
> 
> $ sysctl kern.version
> kern.version=OpenBSD 7.0-current (GENERIC.MP) #370: Sat Feb 19 10:36:59 MST 
> 2022
>     dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
> $ set -A _KERNV -- $(sysctl -n kern.version |
> >         sed 's/^OpenBSD \([1-9][0-9]*\.[0-9]\)\([^ ]*\).*/\1 \2/;q')
> 
> $ echo ${_KERNV[1]}
> -current


I don't think so, that is the running kernel, I need the version of the
_new_ kernel.  Imagine this situation:

Someone installs -current shortly after release, a new version of DRM is
imported (or really, any firmware is updated along with the driver) and
then we move to -beta.  This someone sees that and realizes they should
upgrade.  They are still on 7.0-current, but the new kernel is 7.1-beta
and they should be looking for firmware in /7.1, not /snapshots (and
using the 7.1 signify key).

I think I see a way to figure this out from the logic above
(specifically whether we're using the new signify keys with a
snapshot) but I'll have to stare at it a bit more.

Reply via email to