Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Nov 2004 21:27:52 +0100
From:      "A. Nooitgedagt" <a.nooit@12move.nl>
To:        "Kris Kennaway" <kris@obsecurity.org>
Cc:        freebsd-ports@freebsd.org
Subject:   RE: Pass variable to pkg-install
Message-ID:  <NCEAIDGINCIDIPEKFPHDEEIODGAA.a.nooit@12move.nl>
In-Reply-To: <20041123181119.GB91215@xor.obsecurity.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> -----Original Message-----
> From: owner-freebsd-ports@freebsd.org
> [mailto:owner-freebsd-ports@freebsd.org]On Behalf Of Kris Kennaway
> Sent: dinsdag 23 november 2004 19:11
> To: A. Nooitgedagt
> Cc: freebsd-ports@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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NCEAIDGINCIDIPEKFPHDEEIODGAA.a.nooit>