Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
Hello all, net/gitup uses a reinplace cmd to setup gitup.conf to the correspondent RELEASE/STABLE for command `gitup release` and `gitup stable`. So, if user is using 13.1-RELEASE, reinplace will configure gitup.conf to: "release" : { "branch" : "releng/13.1", "stable" :

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Nuno Teixeira [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.

Re: Get ${OSREL} at install time

2023-04-18 Thread Piotr Smyrak
On Tue, 18 Apr 2023 09:05:36 +0100 Nuno Teixeira wrote: > net/gitup uses a reinplace cmd to setup gitup.conf to the > correspondent RELEASE/STABLE for command `gitup release` and `gitup > stable`. So, if user is using 13.1-RELEASE, reinplace will configure > gitup.conf to: > > "release" : { >

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
Hey, 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 > > It's not exactly nice, just parsing the version manually... > Maybe this it what I'm looking

Re: Get ${OSREL} at install time

2023-04-18 Thread Yuri
Felix Palmen wrote: > * Nuno Teixeira [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/

Re: Get ${OSREL} at install time

2023-04-18 Thread Yuri
Yuri wrote: > Felix Palmen wrote: >> * Nuno Teixeira [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: >&

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
Hello Piotr, Yes, something like it. I will not need src sys/conf/newvers.sh, /etc/os-release will do the job. Thinking right now in a way to check /etc/os-release version at install time. Cheers Piotr Smyrak escreveu no dia terça, 18/04/2023 à(s) 09:56: > On Tue, 18 Apr 2023 09:05:36 +0100 >

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
. Thanks all! Felix Palmen escreveu no dia terça, 18/04/2023 à(s) 09:52: > * Nuno Teixeira [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,

Re: Get ${OSREL} at install time

2023-04-18 Thread Eugene Grosbein
18.04.2023 15:05, Nuno Teixeira wrote: > Hello all, > > net/gitup uses a reinplace cmd to setup gitup.conf to the correspondent > RELEASE/STABLE for command `gitup release` and `gitup stable`. > So, if user is using 13.1-RELEASE, reinplace will configure gitup.conf to: > > "release" : { >

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Yuri [20230418 11:07]: > 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. Just a quick hint: /etc/os-release is preferred because it will still work correctly when inst

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Eugene Grosbein [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 wro

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Yuri [20230418 11:11]: > Yuri wrote: > > 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 i

Re: Get ${OSREL} at install time

2023-04-18 Thread Eugene Grosbein
18.04.2023 16:26, Eugene Grosbein wrote: > 18.04.2023 15:05, Nuno Teixeira wrote: >> Hello all, >> >> net/gitup uses a reinplace cmd to setup gitup.conf to the correspondent >> RELEASE/STABLE for command `gitup release` and `gitup stable`. >> So, if user is using 13.1-RELEASE, reinplace will conf

Re: Get ${OSREL} at install time

2023-04-18 Thread Eugene Grosbein
18.04.2023 16:34, Felix Palmen wrote: > * Eugene Grosbein [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 informa

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Eugene Grosbein [20230418 16:41]: > 18.04.2023 16:34, Felix Palmen wrote: > > > * Eugene Grosbein [20230418 16:26]: > >> 18.04.2023 15:05, Nuno Teixeira wrote: > >>> Any sugestion or example that permits to get OSREL at install time? > >&g

Re: Get ${OSREL} at install time

2023-04-18 Thread Eugene Grosbein
18.04.2023 16:51, Felix Palmen wrote: > 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... You don't need lua to create pkg-message dynamically

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Eugene Grosbein [20230418 17:03]: > 18.04.2023 16:51, Felix Palmen wrote: > > > 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-

Re: Get ${OSREL} at install time

2023-04-18 Thread Piotr Smyrak
On Tue, 18 Apr 2023 10:10:57 +0100 Nuno Teixeira wrote: > Yes, something like it. I will not need src sys/conf/newvers.sh, > /etc/os-release will do the job. > > Thinking right now in a way to check /etc/os-release version at > install time. You also can check output from freebsd-version(1). It

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
pkg-plist: @postexec env osrel=$(freebsd-update -u) sed -E -e s,stable/[0-9]+,stable/${osrel\%\%.*}, -e s,releng/[0-9]+,releng/${osrel\%\%-*}, %%PREFIX%%/etc/gitup.conf Result: /bin/sh: ${osrel\...}: Bad substitution pkg-static: POST-INSTALL script failed Other aproach: pkg-post-install --- #!/b

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Nuno Teixeira [20230418 11:55]: > sed -E -e 's|stable\/12|stable\/${stable}|' -e [...] > sed doesn't subtitute as it uses literal variables The shell doesn't subsitute variables inside single quotes. Try double quotes instead. -- Felix Palmen {private} fe

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
"target_directory" : "/usr/src", "ignores" : [ "sys/[^\/]+/conf", --- Nice! I have now a working pkg-post-install. Need to have a pkg-plist method working too so it can be discussed the best method to use. Felix

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
res" : [ > "sys/[^\/]+/conf", > --- > > Nice! I have now a working pkg-post-install. > Need to have a pkg-plist method working too so it can be discussed the > best method to use. > > Felix Palmen escreveu no dia terça, 18/0

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
"repository_path" : "/src.git", >> "branch" : "stable/13", >> "target_directory" : "/usr/src", >> "ignores" : [ >>

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Nuno Teixeira [20230418 12:38]: > @postexec env osrel=$(freebsd-version -u) sed -E -e > "s,stable/[0-9]+,stable/${osrel%%.*}," -e > "s,releng/[0-9]+,releng/${osrel%%-*}," %%PREFIX%%/etc/gitup.conf This can't work because the shell will expand ${osrel%%...} b

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Felix Palmen [20230418 13:48]: > BTW, another thing might be a bit problematic here: Calling > freebsd-version like this will work when pkg is used with -c (using > chroot), but most likely not with -r. Forgot to mention the solution: Call ${PKG_ROOTDIR}/bin/freebsd-version instead

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
ok, pkg-script manual have also something interesting for finding prefix: PKG_PREFIX PREFIX defined within the package at build time. So I can use ${PKG_PREFIX}/etc/gitup.conf About ${PKG_ROOTDIR}/bin/freebsd-version it doesn't seem to be called in pkg-post-install: osrel=${PKG_ROOTDI

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Nuno Teixeira [20230418 13:26]: > About ${PKG_ROOTDIR}/bin/freebsd-version it doesn't seem to be called in > pkg-post-install: > osrel=${PKG_ROOTDIR}/bin/freebsd-version > > Am I missing something? Yes, actually executing it ;) | osrel=$(${PKG_ROOTDIR}/bin/freebsd-ver

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
ranch" : "stable/13", "target_directory" : "/usr/src", "ignores" : [ "sys/[^\/]+/conf", --- Felix Palmen escreveu no dia terça, 18/04/2023 à(s) 13:33: > * Nuno Teixeira [

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Nuno Teixeira [20230418 13:37]: > It works fine with just `freebsd-version`, do you recommend '-u'? It's the default mode, so explicitly adding it would only serve a purpose if the default ever changed. Not very likely I guess. -- Felix Palmen {private} fe...@palm

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
Ok, I will include '-u' then. I will do further tests and open an PR so other people try it (I hope). I will also read and try pkg-lua-script manual because it seems very interesting. Thanks, Felix Palmen escreveu no dia terça, 18/04/2023 à(s) 13:39: > * Nuno Teixeira [2

Re: Get ${OSREL} at install time

2023-04-18 Thread Felix Palmen
* Nuno Teixeira [20230418 13:45]: > I will do further tests and open an PR so other people try it (I hope). I would suggest a final improvement: You should probably sanity-check what you get from freebsd-version (and in case it isn't sane, stick to the compile-time defaults). That's

Re: Get ${OSREL} at install time

2023-04-18 Thread Nuno Teixeira
Ok, I will continue testing. BTW, I've openned a PR at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270911 Please test :) Thanks all Felix Palmen escreveu no dia terça, 18/04/2023 à(s) 14:13: > * Nuno Teixeira [20230418 13:45]: > > I will do further tests and open an PR s

Re: Get ${OSREL} at install time

2023-04-18 Thread Jose Quinteiro
On 4/18/23 03:03, Eugene Grosbein wrote: > 18.04.2023 16:51, Felix Palmen wrote: > >> 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... > > Y

Unmaintained FreeBSD ports which are out of date

2023-04-18 Thread portscout
Dear port maintainers, The portscout new distfile checker has detected that one or more unmaintained ports appears to be out of date. Please take the opportunity to check each of the ports listed below, and if possible and appropriate, submit/commit an update. Please consider also adopting this po