Pass variable to pkg-install

A. Nooitgedagt a.nooit at 12move.nl
Tue Nov 23 12:27:52 PST 2004


> -----Original Message-----
> From: owner-freebsd-ports at freebsd.org
> [mailto:owner-freebsd-ports at freebsd.org]On Behalf Of Kris Kennaway
> Sent: dinsdag 23 november 2004 19:11
> To: A. Nooitgedagt
> Cc: freebsd-ports at freebsd.org
> Subject: Re: Pass variable to pkg-install
>
>
> On Tue, Nov 23, 2004 at 11:44:22AM +0100, A. Nooitgedagt wrote:
> > Actually,
> >
> > It does work to set variables in SCRIPTS_ENV !
> > I just shouldn't manipulate them in pkg-install I guess. I'm
> still not sure
> > how it works.
> >
> > This is what I have as a test in Makefile:
> >
> > "
> > pre-fetch:
> >         @ ${SETENV} PKG_PREFIX=${PREFIX} \
> >         ${SCRIPTS_ENV} USER=${USER} PG_USER=${PG_USER} GROUP=${GROUP}
> > UID=${UID} GID=${GID} \
> >         ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
> > "
> >
> > I didn't find good docs about how a statement like that gets
> translate or
> > did I miss something.
> > Any pointer?
>
> Be careful what you do here, because the pkg-install script is also
> run when someone adds (or removes) your package with pkg_add, so it
> needs to work properly in that case too (and it will not if you
> customize the way that pkg-install is called)
>
> Kris

Ouch, pkg_add doesn't read the makefile variables....
That complicates things even more.

Would it be an option to create a config.sh on the fly
while processing the Makefile (no interactive configure):
http://www.freebsd.org/cgi/cvsweb.cgi/ports/net/cvsup-mirror/scripts/configu
re

script:
---------------------------------
#! /bin/sh

variables="USER GROUP UID GID"

echo ""
echo -n "Building the \"config.sh\" file ... "
for var in ${variables}; do
    eval echo ${var}=\\\"\${${var}}\\\"
done > ${WRKSRC}/config.sh
echo "Done."
---------------------------------

pkg-install:
---------------------------------
. ${base}/config.sh || exit
---------------------------------

Or something like that....

Would that be a good option or is there a less complicated example
that would also work for pkg_add?

Aldert





More information about the freebsd-ports mailing list