Subject: Re: /etc/default
To: None <current-users@NetBSD.ORG>
From: Captech) <greywolf@tomcat.VAS.viewlogic.com (James Graham>
List: current-users
Date: 07/26/1995 11:35:53
Greetings (woof).

I've seen several different issues drop in here, and I wanted to see if I could
shed a little light on all of them (outside of the standard "THEY'RE SVRx
AND SHOULD NOT BE HERE", with which I partially agree):

	- nsswitch.conf for system databases
	- inittab-based rc*.d stuff
	- different init run levels
	- /etc/default stuff for system apps

* nsswitch.conf

	This is rather interesting.  I think they tried to do something right
	here, but they threw in the "compat" keyword which is only valid with
	two databases:  passwd and group.  If we were to do something like
	this, the obvious thing which would occur to me is that NIS stuff
	should be drawn in iff it hits a '+' in the file and possibly '@'
	for hesiod stuff (i.e. "compat" mode should be the default).

	On the other hand, it is kind of nice to be able to specify the order
	in which you want your databases read.  For lookups to default to NIS
	for all other maps (Sun ignores many local files completely if NIS is
	running) is absurd.  This is, of course, easily overcome by the rules
	above.  I think Theo brought this up.  It's a good point.

	As I don't have a running system yet (I intend to cure this real
	soon now), I can't check the specifics, so I don't know the order
	in which host resolution is done (i.e. is it files/DNS/NIS or
	files/NIS/DNS or is NIS ignored altogether? etc.).

* inittab and /etc/rc*.d

	Personally, I think the SVRx init stuff is an abomination.  That's
	why I'm trying to run NetBSD instead of settling for Solaris.
	(I should say, "MOST of the SVRx init stuff is an abomination.")

	Someone asked "how do I get instantly into single-user mode?" and
	complained about a magic incantation.  Firstly, there are two of them:
		- "kill 1"
		- "shutdown now" (which amounts to about the same thing)

	Secondly, in case nobody has noticed, "init s" doesn't always do
	the right thing -- at least it hasn't for me.  Sometimes it will
	go into single-user mode (or so it says) and not kill quite a few
	of the networking processes.

	It WOULD be kind of cool to have a more modular rc structure
	(rc.boot rc.single rc (multi) rc.local rc.net) which would be
	run for various states.  The files are mostly there (rc.single
	is missing, but we don't *really* need it), but the states
	are not -- it has been pointed out that there is no mechanism
	in place for determining whether or not network initialisation
	has succeeded.

	I would think that a lock file (/.nonet) would be sufficient for
	this.

* Init run states

	The idea of 8 run levels (S0123456) is excessive, especially con-
	sidering that 4 of them are used for shutting the system down.
	There appear to be 4 down states and 4 up states:

		S:	up single-user		(boot -s)
		0:	shutdown, power off	(shutdown -h/shutdown; halt)
		1:	shutdown, go to single-user	(shutdown)
		2:	up multi-user		(boot)
		3:	up multi-user, networked	(boot)
		4:	up multi-user, networked, with a side of bacon (boot)
		5:	shutdown, go to firmware interactive mode	(n/a)
		6:	shutdown, reboot (shutdown -r/shutdown; reboot)

	Berkeley had the right idea (at first, anyway):  You can really
	only be in one of the following states:
		- halted
		- up single-user
		- up multi-user	(Networked didn't come until later).

	If you're down, the software shouldn't care about the state of
	the firmware, though it's nice to hand 'reboot' parameters to
	give to the bootloader (i.e. reboot single-user, reboot from a
	different disk (like the current one if you didn't boot from
	the default)).

	Also, outside of the "init s" problem in the previous section,
	I've discovered another annoyance.  In Berkeley, from single-user,
	one can type "exit" or (more common) hit ^D at the shell prompt,
	walk away and know that the machine will come back up (barring
	any really serious problems).  Every SVRx-based machine I have
	encountered won't let you do this.  You type ^D at the single-user
	shell and it sits there for about 3-10 seconds and then asks

	ENTER RUN LEVEL (0-6 or S):

	It doesn't even have the common sense to look at the initdefault
	entry in /etc/inittab!

	When I hit ^D, I want to *walk away* and not have to look back.
	If I want something else besides the default, OK, I'll break down
	and type "init whatever" or perhaps "nonet" (a function to 
	"exec touch /.nonet") or "net" (a function to "exec rm -f /.nonet").

	Or something (I'd prefer to avoid things like 'init 3' or 'init 5').

* /etc/default

	Here is where I see a potential can of pointers to functions returning
	pointers to cans of worms.  One can either argue that SVR4 took it
	too far in doing this at all, or one can argue that they didn't take
	it far enough because they didn't make it extensible (which is true).

	I could see having defaults files for programs which make use of
	tape drives, for example (so you could select a default device
	or ordered list of devices for the unaware (if that doesn't draw
	fire, nothing will!)).  However, SVR4 did it the wrong way with
	respect to things like login (root is limited to logging in on
	one device or permitted to log in from anywhere, as opposed to the
	ttys method).

	Looking at Solaris, they have defaults files for:  login, su, cron,
	init, tar, utmpd, and passwd.

	I don't see much use for any except possibly tar, and, despite my
	statement two paragraphs back (yes, 2 != 2 right now), I have my
	doubts as to the true purpose of that one.

And, of course, being a BSD die-hard from 4.2 (some of you come from an
even earlier age, I'm sure), I don't see SVR4isms as being a win in this
arena.

I want my..........
I want my BSD	(Money for nothin')

Silly, immature, definitely.  But what I'm getting at is that there are 
better ways of accomplishing the desired effects than copying the methods
used by SVR4.

What we have is not seriously broken (modulo the default state of -current
(which is why it's called -current)), so don't fix it.

					My (char) (0xff & 0x03) worth;

					--*greywolf;