Subject: Re: defaulting rc.d scripts to share/examples/rc.d
To: grant beattie <grant@NetBSD.org>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 09/24/2004 04:26:46
On Fri, Sep 24, 2004 at 09:43:07AM +1000, grant beattie wrote:
> On Thu, Sep 23, 2004 at 04:35:05PM -0700, Jeremy C. Reed wrote:
>
> > 1) /usr/pkg/etc/rc.d is the location for the examples to be installed.
> > Other config examples are installed to /usr/pkg/share/examples. This is
> > inconsistent.
>
> this implies that the supplied rc.d scripts are "examples", which is
> not entirely true.
I disagree. The PKGINSTALL framework treats rc.d scripts exactly like
config files; it assumes that the rc.d scripts in ${RCD_SCRIPTS_DIR}
can be modified by the user after installation, so the ones supplied
by the package at the well-known location /usr/pkg/etc/rc.d really
are examples.
> > 2) pkgsrc users assume that /usr/pkg/etc/rc.d automatically works for
> > starting at boot. If the scripts were in "examples" directory they'd know
> > that they have to configure something extra.
>
> imho you shouldn't have to. you should just be able to tweak a knob
> and have things Just Work, using all of the rc.d scripts of currently
> installed pkgs.
I don't think this is a good idea. We don't give package maintainers
any guidelines for how to write rc.d scripts, and as a consequence,
they vary quite a bit in quality. Since the last thing you want is
for a machine that boots to automatically start processes that you
didn't yet configure, I don't think this idea is ready for the real
world.
> > 3) pkgsrc already has option to install from "examples" directory to real
> > rc.d directory. Most pkgsrc users don't know about it.
>
> that should be relatively simple to fix (and is related to having
> things Just Work), but is a separate issue to the location of the
> examples dir.
PKG_RCD_SCRIPTS=YES does exactly this, and I've had it in my /etc/mk.conf
since ~forever, but this does leave me open to the problem I note
above, which *has* bitten me several times. That's exactly why it
defaults to "NO".
> > 4) If you modify a rc.d script, your modifications could get removed or
> > lost on upgrade.
> >
> > 5) Since the directory allowed customization before, it could be set to
> > outside of LOCALBASE and cause problems with packaging list.
>
> I use RCD_SCRIPTS_DIR=/etc/pkg/rc.d on a number of machines without
> this problem. the proper way of supplying rc.d scripts doesn't need
> them in the PLIST.
>
> it also seems that RCD_SCRIPTS_EXAMPLEDIR is already an absolute path,
> so ${PREFIX}/${RCD_SCRIPTS_EXAMPLEDIR} would break things.
We can easily guard against this by adding a check to bsd.pkg.install.mk:
.if empty(RCD_SCRIPTS_EXAMPLEDIR:M${PREFIX}/*)
PKG_FAIL_REASON+= \
"bsd.pkg.install.mk: RCD_SCRIPTS_EXAMPLEDIR can't be an absolute path."
.endif
FWIW, I think the change to use share/examples/rc.d is a good idea.
In general, the files in /usr/pkg/etc are all config files, and we
really shouldn't install stuff there that we don't want to be modified.
Cheers,
-- Johnny Lam <jlam@NetBSD.org>