On Mon, Feb 28, 2022 at 05:28:19PM +0100, Stefan Hagen wrote:
> Andrew Hewus Fresh wrote (2022-02-28 15:40 CET):
> > On Mon, Feb 28, 2022 at 02:47:24PM +0100, Stefan Hagen wrote:
> > > But now I see that NEXT_VERSION is set earlier and this should fix it:
> > >
> > > -if $RELEASE && [[ ${_KERNV[1]} == '-beta' ]]; then
> > > +if $RELEASE || [[ ${_KERNV[1]} == '-beta' ]]; then
> >
> > It would fix this particular case, but this code is here for the
> > situation where:
> >
> > A user is on 7.1-beta, 7.1 is release and the user does `sysupgrade -r`
> >
> > This patch would break that case. I will keep thinking on a proper
> > fix.
>
> Are you sure?
I'm sorry, PagerDuty woke me up at 4am and I replied above without
coffee. This is not the case that would break.
> I made myself a small table with the possible upgrade paths how I
> see them:
>
> Source rel. | Target rel. | Firmware dir.
> ------------+-------------+----------------
> 7.0-release | 7.1-release | ${NEXT_VERSION}
This case, with `sysupgrade -r`, would break. In this case, RELEASE is
true and _KERNV[0] is 7.0, which makes this true:
+if $RELEASE || [[ ${_KERNV[1]} == '-beta' ]]; then
NEXT_VERSION=${_KERNV[0]}
and sets NEXT_VERSION to 7.0, which is not what I would expect.
> 7.0-release | 7.1-beta | ${NEXT_VERSION}
> 7.0-release | 7.0-current | snapshots
> -
> 7.0-current | 7.1-release | ${NEXT_VERSION}
> 7.0-current | 7.1-beta | ${NEXT_VERSION}
> 7.0-current | 7.0-current | snapshots
> -
> 7.1-beta | 7.1-release | ${_KERNV[0]}
> 7.1-beta | 7.1-beta | ${_KERNV[0]}
> 7.1-beta | 7.1-current | snapshots
>
> If you don't look at the release/beta/current tags and compare the
> release version number instead, it gets simpler:
>
> source_VER == target_VER: ${_KERNV[0]}
> source_VER != target_VER: ${NEXT_VERSION}
> both overruled by -current: snapshots
>
> Regarding the regex: The output of
> sysctl -n kern.version
> is the same as
> echo exit | config -eo /dev/null bsd
>
> So the regex used to parse the information for _KERN can be reused.
I'll make sure I'm doing that.