Subject: Re: a couple of package related issues
To: Eivind Eklund <eivind@yes.no>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-pkg
Date: 08/31/1998 22:25:24
>On Sun, Aug 30, 1998 at 07:15:19PM -0600, Jim Bernard wrote:
>>   I can't resist pointing out that, if we had rc.d or something similar,
>> there would be no issue here at all.  pkg_add would dump a script into a
>> standard location, and the system administrator would examine and activate
>> it at his/her leisure.  Of course, the very mention of the concept is
>> considered blasphemy by some.

>FreeBSD does this by having /usr/local/etc/rc.d (or actually
>${PREFIX}/rc.d).  I don't see it as a perfect solution (I'd like to
>have dependencies between different packages be explict), but at least
>it works...

Yes, though their rather simplistic logic in rc.local (if I recall) 
limits its flexibility.  

At the risk of flogging a dead horse (why do I bother? because I administer
at least 80 machines of various OS, release and hardware, and I find
the start/stop script mechanism - when done right, extremely helpful in
managing that task with minimal effort).

>Date: Sun, 26 Jul 98 14:03:46 EST
>From: "Simon J. Gerraty" <sjg@quick.com.au>
>Message-Id: <199807260402.OAA07678@zen.quick.com.au>
>References: <XFMail.980725040423.root@garbled.net>

>Tim Rightnour <root@garbled.net> wrote:
>>We either make the pkg interactive, and say "do you want to do this" or tell
>>them, "run this to do this" then:
>>add apache to /etc/rc.local
>
>I asume that anything that frobs /etc/rc.local, also has the appropriate 
>magic to undo the damage if requested?  
>
>The only addition I normally make to /etc/rc.local (or /etc/rc2.d) is to 
>have it run /etc/rc_local at the end (/etc/rc_local -> /etc/rc.sh) so 
>that any start scripts in /etc/rc_local.d get run.
>
>Then adding/removing services is a simple matter of adding/removing symlinks
>from /etc/rc_local.d - and you always have the start/stop script handy in 
>/etc/rc_d.
>
>I use the "odd" names to ensure that there is no conflict with vendor stuff
>as I use the exact same setup on all sorts of machines other than NetBSD.
>
>Regardless of the religious debate over wether individual start/stop scripts
>would benefit NetBSD as a whole, I suspect the pkg stuff could benefit 
>greatly from the above.
>
>Upgrading pkgs would not need a re-edit of rc.local, just update the 
>start/stop script in /etc/pkg.d.
>
>At the very least it would mean that to address Tim's concern, 
>the only question a user would need to answer would be if they want the 
>service started automagically at boot.  If no, simply omit the symlink 
>in rc_local.d (or rc_pkg.d if you like), or create it as say s45foo if 
>you want to document the normal startup order - incase it matters.  The
>if the user later changes their mind they can rename s45foo to S45foo.
>
>An alternative would be to have another target in the start/stop script to
>enable/dissable autostart.
>
>Many of my current start/stop scripts include restart and check targets 
>which is handy for important daemons like sendmail, named, ntp etc.
>Simply adding a symlink in /etc/hourly.d like S10check_{ntp,pppd,...}
>helps ensure that they are running.
>
>If anyone wants to have a look, rc.sh and a few useful start/stop scripts 
>are included in my configs tool 
>(see http://www.quick.com.au/FreeWare/configs.html)
>
>
>--sjg