Re: Get ${OSREL} at install time

From: Yuri <yuri_at_aetern.org>
Date: Tue, 18 Apr 2023 09:07:37 UTC
Felix Palmen wrote:
> * Nuno Teixeira <eduardo@freebsd.org> [20230418 09:05]:
>> Any sugestion or example that permits to get OSREL at install time?
> 
> Not really OSREL, but when I needed to know the FreeBSD version at
> install time, this is what I did:
> 
> https://cgit.freebsd.org/ports/tree/security/unix-selfauth-helper/pkg-post-install.lua

Took a look at this and now I'm wondering if it gets run at all, you
don't seem to specify PKGPOSTINSTALL in the Makefile, and bsd.port.mk
has it as just pkg-post-install, not handling .lua?  It's also is not in
the .pkg file contents.  Sorry if I'm missing something.

> It's not exactly nice, just parsing the version manually...

I was going to suggest something similar with using kern.osreldate and
parsing it according to
https://docs.freebsd.org/en/books/porters-handbook/versions/, e.g.

1301000 <= value < 1301500 - 13.1-RELEASE
1301500 <= value < 1302000 - outdated 13.1-STABLE
1302000 <= value < 1302500 - 13.2-RELEASE
1302500 <= value < 1303000 - current 13.2-STABLE
1400000 <= value           - 14.0-CURRENT