README revision 50479
138889SjdpWarsaw, 1998.07.07
299461Sobrien
338889SjdpThis README shortly describes the features of "oinit" - a very simplistic
438889Sjdpversion of init(8) combined with a shell.
538889Sjdp
638889SjdpFeatures
738889Sjdp--------
838889Sjdp
938889Sjdp* oinit is able to run system in multi- and single-user modes,
1038889Sjdp* it can be started on system with DEVFS/SLICE (i.e. empty /dev),
1138889Sjdp* provides minimalistic user interface, called "shell()",
1238889Sjdp* it can run the system startup script (/etc/rc),
1338889Sjdp* it can be compiled with -DOINIT_RC to use its own startup script
1438889Sjdp  (*very* primitive, but doesn't require any real shell to run it!),
1538889Sjdp* doesn't require the whole chain of init->getty->login->shell to be run,
1638889Sjdp* it is extremely small, and is ideally suited for situations when
1738889Sjdp  there is little memory.
1838889Sjdp
1938889SjdpAs an additional bonus you receive some obvious and some hidden bugs... :-))
2038889SjdpThis code is at most alpha quality yet.
2138889Sjdp
2238889Sjdp
2338889SjdpHow it works
2438889Sjdp------------
2538889Sjdp
2638889SjdpUnlike normal init(8), it forks itself on given number of vty's immediately
2738889Sjdpproviding shell() interface. Currently it doesn't require (and is unable to
2838889Sjdpperform) any authentication, but this is easy to add if needed.
2989857Sobrien
3038889SjdpStandard version of FreeBSD kernel looks for /sbin/init first, and then
3138889Sjdptries to execute it. If it fails, it tries to find:
3238889Sjdp	/sbin/oinit
3338889Sjdp	/sbin/init.bak
3438889Sjdp	/stand/sysinstall
3538889Sjdp
3638889SjdpSo it is easy to make use of it even on standard system - just put it in
3738889Sjdp/sbin/oinit and rename /sbin/init to something else, e.g. /sbin/init.bak.
3838889Sjdp
3938889Sjdp+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4038889Sjdp!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
4138889Sjdp+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4238889SjdpInit (or oinit) plays crucial role in the system. If you plan to do any
4338889Sjdpchanges to your system's init, make sure you have a boot floppy with working
4438889Sjdpversion of statically compiled init(8) on it - you can very easily put your
4538889Sjdpsystem in unusable state when fiddling with it.
4638889Sjdp+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4738889Sjdp
4838889SjdpShell() interface
4938889Sjdp-----------------
5038889Sjdp
5138889SjdpIt allows you to issue built-in and external commands. Built-in commands
5238889Sjdpare listed below. For each command there is short help available, with
5338889Sjdpexample of usage.
5438889Sjdp
5538889Sjdp	cd	change working directory
5638889Sjdp	pwd	print working directory
5738889Sjdp	set	set environment variable (no expansion)
5838889Sjdp	unset	unset environment variable
5938889Sjdp	env	print all environment variables
6038889Sjdp	echo	echo arguments on stdout
6138889Sjdp	exit	exit from shell (oinit will start a new one after some delay)
6238889Sjdp	.	source-in a file with commands
6338889Sjdp	?	help
6438889Sjdp
6538889SjdpAny other command is passed to execvp(3) as it is.
6638889Sjdp
6738889SjdpEXCEPTION: if you end the command line with a '&', the command is started
6838889Sjdpas daemon. This is NOT the same as in normal shell, where the '&' puts a
6938889Sjdpprocess in background. Here the newly started process is totally dissociated
7038889Sjdpfrom terminal.
7138889Sjdp
7238889SjdpPrompt tells you:
7338889Sjdp* your `pwd`
7438889Sjdp* your PID
7538889Sjdp* and that you are root ('#').
7638889Sjdp
7738889SjdpWARNING: this pseudo-shell doesn't do any expansion whatsoever.
7838889Sjdp
7938889SjdpTo do list
8038889Sjdp----------
8138889Sjdp
8238889Sjdp- oinit proper:
8338889Sjdp	* fix signal handling and transitions,
8438889Sjdp	* invent a one-file configuration database (combining as many files
8538889Sjdp	  from /etc as possible into one) able to properly handle inter-
8638889Sjdp	  dependencies in running various daemons,
8738889Sjdp	* allow for interpreting of such database, and running various
8838889Sjdp	  programs ourselves (this would eventually allow to make /bin/sh
8938889Sjdp	  an option, not necessity),
9038889Sjdp	* better hooks for incorporating other modules into oinit (see e.g.
9138889Sjdp	  the telnet() below),
9238889Sjdp	* add optional authentication,
9338889Sjdp
9438889Sjdp- shell():
9538889Sjdp	* more built-ins: perhaps 'kill' and 'ps',
9638889Sjdp	* variable expansion,
9738889Sjdp	* globbing,
9838889Sjdp	* conditionals,
9938889Sjdp	* history? (it depends on how much memory it needs).
10038889Sjdp	* programmatic hooks for easy customisation of user interface (like
10138889Sjdp	  hierarchy of commands and contexts),
10238889Sjdp	* ...
10338889Sjdp
10438889Sjdp- implement as a routine (like shell()) a small remote login daemon telnet(),
10538889Sjdp  as a built-in module to oinit. It would implement the simplest options of
10638889Sjdp  normal telnet, and would itself handle authentication, passing control to
10738889Sjdp  shell() on success. The authentication routine would be the same as for
10838889Sjdp  checking console access.
10938889Sjdp
11038889SjdpAnd allow me for a moment of day-dreaming: I'd like to rewrite oinit one day
11138889Sjdpto be a monolithic one-in-all application, non-forking but multithreaded... It
11238889Sjdpwould contain all the modules, such as shell(), telnet(), ifconfig() etc...
11338889Sjdpstarted as threads, not separate processes.
11438889Sjdp
11538889SjdpCredits
11638889Sjdp-------
11738889Sjdp
11838889SjdpThe overall framework was taken from FreeBSD /sbin/init.
11938889Sjdp
12038889SjdpAndrzej Bialecki
12138889Sjdp<abial@freebsd.org>
12238889Sjdp
12338889Sjdp$FreeBSD: head/release/picobsd/tinyware/oinit/README 50479 1999-08-28 01:35:59Z peter $
12460484Sobrien