Re: Get ${OSREL} at install time

From: Nuno Teixeira <eduardo_at_freebsd.org>
Date: Tue, 18 Apr 2023 12:37:16 UTC
Forgot about it.

It works fine with just `freebsd-version`, do you recommend '-u'?

---
#!/bin/sh -

osrel=$(${PKG_ROOTDIR}/bin/freebsd-version)
releng=${osrel%%-*}
stable=${osrel%%.*}

echo "Configuring gitup.conf for $osrel"

#sed -E -e "s|stable\/12|stable\/${stable}|" -e
"s|releng\/11.4|releng\/${releng}|" /usr/local/etc/gitup.conf
sed -E -e "s,stable/[0-9]+,stable/${osrel%%.*}," -e
"s,releng/[0-9].+,releng/${osrel%%-*}," ${PKG_PREFIX}/etc/gitup.conf

echo debug:
echo osrel=${osrel}
echo releng=${releng}
echo stable=${stable}
echo PREFIX=${PKG_PREFIX}
---
result:

---
debug:
osrel=13.2-RELEASE
releng=13.2
stable=13
PREFIX=/usr/local

 "release" : {
                "repository_path"  : "/src.git",
                "branch"           : "releng/13.2
                "target_directory" : "/usr/src",
                "ignores"          : [
                        "sys/[^\/]+/conf",
                ],
        },

        "stable" : {
                "repository_path"  : "/src.git",
                "branch"           : "stable/13",
                "target_directory" : "/usr/src",
                "ignores"          : [
                        "sys/[^\/]+/conf",
---

Felix Palmen <zirias@freebsd.org> escreveu no dia terça, 18/04/2023 à(s)
13:33:

> * Nuno Teixeira <eduardo@freebsd.org> [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-version -u)
>
> --
>  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
>


-- 
Nuno Teixeira
FreeBSD Committer (ports)