Subject: Re: how to handle dynamic config-file generation?
To: ghen@telenet.be, Geert Hendrickx <geert.hendrickx@ua.ac.be>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-pkg
Date: 08/07/2005 15:49:47
On 8/7/05, Geert Hendrickx <geert.hendrickx@ua.ac.be> wrote:
> On Sun, Aug 07, 2005 at 02:21:54PM +0200, Julio M. Merino Vidal wrote:
> > On 8/7/05, Geert Hendrickx <geert.hendrickx@ua.ac.be> wrote:
> > > On Sun, Aug 07, 2005 at 01:51:20PM +0200, Julio M. Merino Vidal wrote=
:
> > > > On 8/7/05, Geert Hendrickx <geert.hendrickx@ua.ac.be> wrote:
> > > > > I'm creating a package for a program which wants to auto-generate=
 its
> > > > > config file after "make install".  It first checks whether the co=
nfig file
> > > > > (in ${PKG_SYSCONFDIR}) exists, and if not, generates a quite gene=
ric (not
> > > > > at all host-specific) example config file.  How should I handle t=
his in
> > > > > pkgsrc?
> > > >
> > > > Make the package use ${PREFIX}/share/examples/<package>/ instead of
> > > > ${PKG_SYSCONFDIR}.  This way, the file will never exist and will al=
ways
> > > > be generated from scratch.
> > > >
> > > > You can then use the install framework to copy the file into
> > > > ${PKG_SYSCONFDIR} iff needed.  (See CONF_FILES.)
> > >
> > > I thought about that, but the package wants to create the file in the=
 same
> > > location it expects to find it (PKG_SYSCONFDIR).
> >
> > Many packages want to do that, and we "fix" them by doing each action
> > independently (look for the file in one place, but create it somewhere
> > else).  So it is perfectly correct if you do that.
>=20
> I could also create the config file manually from the pkg's Makefile,
> instead of patching the original Makefile.in template.  (The "make config=
"
> target basically just calls the program with --dump-config, pipes the std
> output to the default config location and chmods it.)
>=20
> I think that would require less work.

Sure; if all that's required is to run the program with --dump-config, that
is the best (and simplest) way to do it.

--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/