tech-userlevel archive

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

Re: /etc/rc shebang



EF> I know /etc/init called /bin/sh /etc/rc back in the day,
KRE> It still does, normally.
Yes, that's what I found when reading init.c.

> Not really.
Well, it's /sbin/init now.

> "Executing a script" is just a shorthand way of saying "exexute
> the interpreter for which this script is designed to use and tell it
> to run this script".
Yes. /etc/rc is a Bourne Shell script. The interpreter can be /bin/sh, 
/rescue/sh (I read the code as that /rescue/init uses the latter) or some 
other Bourne Shell.

> [...] but that argv[0] there is just what becomes $0 which /etc/rc
> only uses in error/log messages.
Right, sorry. Of course it's INIT_BSHELL what's executed.

EF> So I guess the manpage should be re-phrased.
KRE> I doubt there's a real need for that.
I would find it useful to read from the manpage, not the source, what actually 
happens.


> If you give boot the -a switch
Well, then I could also just walk by the machine and do everything in 
single user mode.
This is about a backup server (actually two of them) which, for obvious 
reasons, is located in a different (part of of) the building. I need to 
phyically go there with a monitor and a keyboard for single user mode.
I was trying to avoid that.

> If you tell it /rescue/init instead, then that init will use /rescue/sh 
> as the shell to run the rc script.
OK, so my deduction was correct.


> ps: updating the fundamental stuff on an active system, however you do
> it, is always going to be a very dangerous operation.
Yes, sure. Been there, done that (for certain values of "active").
The scheme I use is to create (when, say, updating from -8 to -10) 
/8 and /10, also (for the classical scheme I use) /{usr,var}/{8,10}, 
null-mount /usr/10 to /10/usr etc., copy /etc (and a few other files) 
to /10, unpack the sets there (that being the main reason for the null 
mounts), run /10/usr/sbin/etcupdate -d /10 (my enhanced version that 
playbacks an input file), /10/usr/sbin/postinstall -d /10 fix xyz, go 
single user with /rescue/sh (which is from -8), run a script that, 
according to a configuration file, moves (or not moves) things from /foo 
to /8/foo and from /10/foo to /foo (which takes a only second), and 
/rescue/reboot.
In case anything failes on -10, I go back single user with /rescue/sh, 
run my script which then moves things from /foo to /10/foo and from 
/8/foo to /foo and I'm back to the state before.
I even use that to switch development servers to a different version 
and back to test things on other versions. /rescue always stays at 
the lowest version installed.


Home | Main Index | Thread Index | Old Index