Subject: Re: /usr/pkg/etc/rc.d/*
To: Michael G. Schabert <mikeride@mac.com>
From: Quentin Garnier <netbsd-current-users@quatriemek.com>
List: current-users
Date: 03/16/2003 21:07:49
Le Sun, 16 Mar 2003 14:38:35 -0500
Michael G. Schabert a =E9crit :
> At 11:42 AM +0100 3/16/03, Quentin Garnier wrote:
> >Le Sun, 16 Mar 2003 05:14:22 -0500
> >Michael G. Schabert a =E9crit :
> >>  At 12:23 AM -0500 3/16/03, kpneal@pobox.com wrote:
> >>  >On Sat, Mar 15, 2003 at 03:01:35PM -0800, Greywolf wrote:
> >>  >>  Should /etc/rc.conf by default contain the line:
> >>  >>
> >>  >>  . /usr/pkg/etc/rc.conf
> >>  >>
> >>  >>  at its end?
> >>  >>
> >>  >>  This would roughly complete the root-pkg split.
> >>  >
> >>  >Is /usr mounted when this would happen?
> >>
> >>  Moot. If /usr is not mounted, then /usr/pkg/bin is unavailable, so
> >it>  wouldn't matter if /usr/pkg/etc isn't there. In other words, if we
[...]
> >rc.d scripts must be in /etc because at the time of rcorder, /usr is
> >not mounted (unless a trivial case). Given the dependancies though,
> >/usr is mounted when the time comes for those package to run (they will
> >typically depend on DAEMON).
> >
> >The hack suggested by Greywolf would work (rc.conf is reread by each
> >script) but the problem of rcorder will remain, unless we add a rc.d
> >script named 'pkg' that will rcorder scripts in /usr/pkg/etc/rc.d. This
> >has the drawback of not letting the user precisely define globally the
> >order of scripts.
[...]
> Approach 1)
> Copy/move rc.d files to /etc. Now the files can be read before /usr=20
> is mounted. However, the binaries that are called in the files are=20
> still unavailable until after /usr is mounted. So you must take care=20
> to construct the REQUIRES so that rcorder doesn't execute the script=20
> until after /usr is mounted.

Well, usually packages will require DAEMON or LOGIN, so /usr is mounted at
the time they are run. If a package is *required* before mounting /usr,
then it would not be installed in /usr/pkg in the first place.

> Approach 2)
> Rc doesn't even know about the scripts until after /usr is mounted.=20
> Fine, since nothing could be done anyway.

rcorder is the first thing run by init. It never knows about what's in
/usr until you tell it something about it in /etc.

> You're advocating approach 1, as that will still let rcorder=20
> determine precise order. With approach 2, you would essentially have=20
> an rcorder for the base distribution and an rcorder for packages, to=20
> be run later. I don't really see that as the drawback that you do,=20
> since the users who actually wish to "precisely define globally the=20
> order of scripts" are in no way impeded from still using approach=20
> 1...they'll just have an empty /usr/pkg/etc/rc.conf. They aren't=20

rc.conf is read each time a rc.d script is launched (so when /usr is
eventually mounted, an rc.conf that would source /usr/pkg/etc/rc.conf
would be aware of variables defined there). But rcorder is run only once.

> encumbered by doing anything more than they would be otherwise, but=20
> as a whole, the system will be much more elegant. As it is, we have=20
> rc.conf, rc.lkm, and rc.local. If you don't want to use=20
> /usr/pkg/etc/rc.conf, then adding an /etc/rc.pkg would (1) still=20
> "feel right", (2) keep the same interface. This rc.pkg would be like=20
> rc.conf in that it would be looking for foo=3DYES as opposed to the=20
> rc.local looking for the actual commands or script names. It would=20
> still not allow its options to be rcordered until after /usr is=20
> mounted, since that is where the rc.d files with the order info would=20
> be.

What I suggested in my previous post was I guess exactly that one
solution. Actually, that's what FreeBSD does (at least with the old rc
system, I don't know how rcNG handles this) : launch every package script
at a defined time.

The location of scripts and the location of rc.conf variables (i.e.
whetther or not /etc/rc.conf should include /usr/pkg/etc/rc.conf) are two
seperate problems.

I support inclusion of /usr/pkg/etc/rc.con inside rc.conf, because
whatever way we use to execute packages' rc.d scripts, sourcing
/etc/rc.subr will get the value of the variables. About how we launch the
scripts, using a script rc.d script named pkg that rcorders what it finds
in /usr/pkg/etc/rc.d and starts them would "feel right" IMO, but we would
have to decide whether it requires DAEMON, LOGIN or something else.

I have several packages with rc.d scripts here, gdm requires LOGIN, cupsd
DAEMON. Of course it can be changed, but we still loose a part of
rcorder's interest.

--=20
Quentin Garnier - cube@cubidou.net
"Feels like I'm fiddling while Rome is burning down.
Should I lay my fiddle down and take a rifle from the ground ?"
Leigh Nash/Sixpence None The Richer, Paralyzed, Divine Discontents, 2002.