Re: Get ${OSREL} at install time

From: Felix Palmen <zirias_at_FreeBSD.org>
Date: Tue, 18 Apr 2023 11:48:04 UTC
* Nuno Teixeira <eduardo@freebsd.org> [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%%...} before
executing this whole command (and then, it's still unset).

As a workaround, you could explicitly start another shell, e.g. like

| env osrel=$([...]) /bin/sh -c 'sed -e "s,foo,${osrel%%-*}," [...]'

But this is getting *really* messy, so I'd personally opt for the
explicit post-install script.

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.

-- 
 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