[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setting runlevel to single-user



On Thu, Oct 28, 2004 at 09:54:57PM +0200, Henning Brauer wrote:
> * Ben Goren <ben_(_at_)_trumpetpower_(_dot_)_com> [2004-10-28 20:56]:
> > On 2004 Oct 28, at 10:25 AM, Henning Brauer wrote:
> > 
> > >> The end of rc.local seems perfect.
> > >
> > > no, that is about the worst place you can find, because it is
> > > nontrivial to remove during pkg_delete,
> > 
> > That depends on what kinds of requirements you put on the scripts (and 
> > script-writers). If you require them to follow the already-standard 
> > ``if [ X"${foo_flags}"...'' formula and be properly indented, then it's 
> > trivial. Just whack everything from that first line up through the next 
> > ``fi'' on a line by itself.
> 
> that is going to brake sooner or later. far too fragile.
> 
> -- 
> http://2suck.net/hhwl.html - http://www.bsws.de/
> Unix is very simple, but it takes a genius to understand the simplicity.
> (Dennis Ritchie)
> 
Hello!

I have a differnet approach to this startup mess. I'd recommend a /etc/local/
directory strictly for packages-stuff. Since we have a straight line between
base and packages, wich go to /usr/local, having all the packages conf and 
startup stuff reside in /etc-toplevel doesn't look clean to me. Additionally
this /etc/local contains its own rc.conf containing only lines like

PKG_NAME=flags/NO

this file has to be edited by the user.

Every PKG that wants to be started from rc adds a /usr/local/rc.PKG_NAME
file containing a rc.local-type syntax of 

if -x $foo
	echo $foo; $foo $PKG_NAME
fi

automagically or demand it from the user.

then a /etc/local/rc script to look at /etc/local/rc.conf, process each line:

if $PKG_NAME != NO
	if ./rc.$PKG_NAME
		run rc.$PKG_NAME

Call this /etc/local/rc from /etc/rc, if exists.

Additionally, we could check in rc.$PKG_NAME if $foo is allready running. 
This would allow the lazy|kamikaze user ro just sh /etc/local/rc to (re)start
dead daemons.

The startup-order can be influenced by simply moving the entries in
/etc/local/rc.conf around.

Have a /etc/local/rc.shutdown for packages that need it.
Maybe extract $foo in rc.$PKG_NAME and pkill it?

A local(7)-manpage needs to be created, a additional section to hier(7)
and afterboot(8).

This approach would make it easy for the pkg_delete to clean up by simply
rm /etc/local/rc.PKG_NAME

Advantages: /etc-toplevel is strictly base.
	the ultra-paranoid can mount /etc/local on a seperate partition;)
	clean up is easy for pkg_tools.
	Naming collisions of base-*.conf and PKG.conf are avoided.
	rm /etc/local/* will not harm the base system.
	base and package are clearly seperated.	
	The traditional rc-approach is left untouched.
	The base-rc stuff is left untouched.
	Everything is still in one place, /etc.
Disadvantages:
	a major ports-flag-day is needed.
	all ports-people would have to agree and commit in one release-cycle.

As far as shut up and hack goes, this is a design decision in the first place.


Alf