Subject: Re: What about startup scripts??
To: Al Snell <>
From: Frederick Bruckman <>
List: tech-pkg
Date: 12/31/2000 10:28:25
On Sun, 31 Dec 2000, Al Snell wrote:

> On Sun, 31 Dec 2000, Frederick Bruckman wrote:
> > The *real* problem is, you have to run rcorder early in the boot
> > process, before /usr is mounted.
> The suggestion was to copy /usr/*/etc/rc.d/* to /etc/rc.d whenever a
> package is installed... or at every system shutdown as well for the
> paranoid! This should be thought of as the package registering itself in a
> database rather than parts of the package being installed in silly places!
> The PLIST would *not* show the copy in /etc.

That sounds reasonable, for the most part. What do you do when a
package, like "bind", needs to overwrite a script in the base system?
"Just do it"?

> Package rc.d scripts would
> source /etc/rc.conf *and* /usr/pkg/etc/rc.conf.

Problem: the variables need to be set before you run "rcorder", before
you've done almost anything -- "/" is still mounted read only. The
best separation we can accomplish here is to have /etc/rc.pkg.conf.

> Should there be on /usr/pkg/etc/rc.conf or one per package? The latter
> would make for easier uninstalls...

There's nothing to do on uninstall...

At pkg install time, check to see if there's an entry in
/etc/rc.{,pkg.}conf, if so, leave it, if not, "cat>>" it (so "rcorder"
doesn't whine), but default it to "NO". When the package is deleted,
leave /etc/rc.{,pkg.}conf alone. It's similar to the situation where
you run a program that leaves preferences in your home directory. The
expectation is that the settings remain when the program is gone. If
you want to delete them, you know where they are.

Let's say you go to the trouble of deleting the entry in
/etc/rc.{,pkg.}conf when you delete the package (or the file
/etc/pkg/rc.<pkg>.conf, yuck). Then the rc script, which you left in
/etc/rc.d/, will, in the absence of checkyesno() returning any value,
fail no more or less gracefully than if you'd left an uninstalled
package enabled. Basically, it'll say "<program> not found", rather
than "warn <variable> is not set properly".

If we must set uninstalled packages to not try to start, it's as easy
as "cp -p /etc/rc.pkg.conf /etc/rc.pkg.conf.old; sed
'/^<variable>/s|YES|NO|' </etc/rc.pkg.conf.old >/etc/rc.pkg.conf", but
I would prefer to leave that to the user who turned it on.

> /etc/rc.d can be trivially regenerated from a base install by rerunning
> the script that copies /usr/local/etc/rc.d/* and /usr/pkg/etc/rc.d/*
> there.

and possibly /usr/X11R6/etc/rc.d/. If I were tasked to automate this
(for sysinstall), I think I would grep over /var/db/pkg/*/+CONTENTS
for \/rc.d\/, and copy all those in. [Keep in mind that /usr/X11R6 and
/usr/pkg are only defaults, and not fixed.]