Re: Get ${OSREL} at install time

From: Felix Palmen <>
Date: Tue, 18 Apr 2023 11:48:04 UTC
* 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%%...} 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 <>     {private}
 -- ports committer (mentee) --            {web}
 {pgp public key}
 {pgp fingerprint} 6936 13D5 5BBF 4837 B212  3ACC 54AD E006 9879 F231