Re: Get ${OSREL} at install time
- Reply: Eugene Grosbein : "Re: Get ${OSREL} at install time"
- In reply to: Eugene Grosbein : "Re: Get ${OSREL} at install time"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Apr 2023 09:51:31 UTC
* Eugene Grosbein <eugen@grosbein.net> [20230418 16:41]: > 18.04.2023 16:34, Felix Palmen wrote: > > > * Eugene Grosbein <eugen@grosbein.net> [20230418 16:26]: > >> 18.04.2023 15:05, Nuno Teixeira wrote: > >>> Any sugestion or example that permits to get OSREL at install time? > >> > >> # osrel=$(sysctl -n kern.osrelease) > > > > Obtaining the information from the running kernel has the drawback of > > possibly giving wrong results with pkg -c / pkg -r (installing in an > > alternative root, e.g. a jail or boot environment). > > > > Therefore, parsing /etc/os-release should be preferred. > > Even better, we have freebsd-version -u Actually not better but older ;) IIRC, /etc/os-release was only introduced in 13. But then, it's probably "better" just as long as 12 is still supported... With lua scripts, you can't even use freebsd-version because execution is very restricted for them in pkg. And for some features (like e.g. dynamically creating a pkg-message output), you need lua... -- Felix Palmen <zirias@FreeBSD.org> {private} felix@palmen-it.de -- ports committer (mentee) -- {web} http://palmen-it.de {pgp public key} http://palmen-it.de/pub.txt {pgp fingerprint} 6936 13D5 5BBF 4837 B212 3ACC 54AD E006 9879 F231