Subject: Re: Handling 3rd party rc scripts
To: NetBSD Packages Technical Discussion List <tech-pkg@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 02/06/2002 00:31:09
[ On Tuesday, February 5, 2002 at 20:35:32 (-0600), Frederick Bruckman wrote: ]
> Subject: Re: Handling 3rd party rc scripts
>
> On Tue, 5 Feb 2002, Greg A. Woods wrote:
> 
> > I don't mind $rc_rcorder_flags, but I would _really_ like to separately
> > define the list of any additional directories, and to explicitly do the
> > expansion rather than rely on the magic of someone either explicitly
> > listing new files, or supplying a shell filename expansion pattern.
> 
> Why?

The magic of doing the filename expansions should be explicit, not
reliant on the user getting the right pattern in there -- i.e. the
parameters should be directory names, not filenames or file patterns.

> > One advantage of this is it allows /usr/pkg/etc/rc.d to be a symlink
> > pointing to /etc/rc.d (or even /usr/pkg/etc -> /etc) on any system where
> > /usr (or /usr/pkg) is not on the root filesystem.  I do use this ability
> > on a non-production test machine as it makes test installs much easier.
> 
> Look, if the script is registered to the package in /etc/rc.d, then's
> there's no need to ever do any of that. /usr/{X11R6,pkg}/etc/rc.d no
> longer exists, and all your creative modifications can go into /etc.

Someday that might be true, but it's certainly not today.  Right now my
pacakge rc.d scripts are registered in /usr/pkg/etc/rc.d -- I've just
tricked them into appearing in /etc/rc.d for the purposes of the one or
two test and development machines where I've ended up with /usr/pkg on a
separate filesystem.

In order to have one unified /etc/rc that sorts and orders all scripts
in one dependency graph the actual scripts of course have to live on the
root filesystem.  Having the special checks means I can have
/etc/defaults/rc.conf specify all the "normal" rc.d directories, but
only look in them if they are normal directories (and not symlinks) and
if they actually contain some scripts to run.  This follows the
principle of least surprise for fresh installs where packages with
startup scripts are added -- they will just begin to work properly, at
least with their default configurations.

On almost all of my production systems I've now set LOCALBASE=/usr and I
have a symlink /usr/etc pointing to /etc, so still the files are
registered as being in /usr/etc/rc.d, not /etc/rc.d.  With the careful
checks I can still have a default "rc_more_rc_d=$PKG_PREFIX/etc/rc.d"
setting and yet not suffer from scripts being run multiple times.

However even if all the package rc.d scripts suddenly were to be
installed directly into $PKG_SYSCONFDIR/rc.d (or some place pointed to
by a more specifically named variable that defaults to that same place),
I'd still want to specify additional directory name(s) to /etc/rc, not
some file globbing pattern.

-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>