README revision 50479
155714SkrisWarsaw, 1998.07.07
2280304Sjkim
355714SkrisThis README shortly describes the features of "oinit" - a very simplistic
4273149Sjkimversion of init(8) combined with a shell.
5273149Sjkim
6273149SjkimFeatures
7273149Sjkim--------
8280304Sjkim
9280304Sjkim* oinit is able to run system in multi- and single-user modes,
1079998Skris* it can be started on system with DEVFS/SLICE (i.e. empty /dev),
1159191Skris* provides minimalistic user interface, called "shell()",
1259191Skris* it can run the system startup script (/etc/rc),
1355714Skris* it can be compiled with -DOINIT_RC to use its own startup script
14280304Sjkim  (*very* primitive, but doesn't require any real shell to run it!),
15280304Sjkim* doesn't require the whole chain of init->getty->login->shell to be run,
1659191Skris* it is extremely small, and is ideally suited for situations when
1759191Skris  there is little memory.
18280304Sjkim
19280304SjkimAs an additional bonus you receive some obvious and some hidden bugs... :-))
20280304SjkimThis code is at most alpha quality yet.
21280304Sjkim
2259191Skris
2359191SkrisHow it works
2459191Skris------------
2559191Skris
2659191SkrisUnlike normal init(8), it forks itself on given number of vty's immediately
2759191Skrisproviding shell() interface. Currently it doesn't require (and is unable to
2859191Skrisperform) any authentication, but this is easy to add if needed.
2955714Skris
3059191SkrisStandard version of FreeBSD kernel looks for /sbin/init first, and then
3159191Skristries to execute it. If it fails, it tries to find:
3255714Skris	/sbin/oinit
33296317Sdelphij	/sbin/init.bak
34280304Sjkim	/stand/sysinstall
35296317Sdelphij
36280304SjkimSo it is easy to make use of it even on standard system - just put it in
37296317Sdelphij/sbin/oinit and rename /sbin/init to something else, e.g. /sbin/init.bak.
38280304Sjkim
39280304Sjkim+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4055714Skris!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
41280304Sjkim+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42280304SjkimInit (or oinit) plays crucial role in the system. If you plan to do any
4368651Skrischanges to your system's init, make sure you have a boot floppy with working
4468651Skrisversion of statically compiled init(8) on it - you can very easily put your
4568651Skrissystem in unusable state when fiddling with it.
4668651Skris+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4768651Skris
4868651SkrisShell() interface
4968651Skris-----------------
50280304Sjkim
5168651SkrisIt allows you to issue built-in and external commands. Built-in commands
5268651Skrisare listed below. For each command there is short help available, with
5368651Skrisexample of usage.
54280304Sjkim
5568651Skris	cd	change working directory
5689837Skris	pwd	print working directory
5789837Skris	set	set environment variable (no expansion)
5889837Skris	unset	unset environment variable
5989837Skris	env	print all environment variables
6089837Skris	echo	echo arguments on stdout
6189837Skris	exit	exit from shell (oinit will start a new one after some delay)
6289837Skris	.	source-in a file with commands
6368651Skris	?	help
6468651Skris
6568651SkrisAny other command is passed to execvp(3) as it is.
6668651Skris
6768651SkrisEXCEPTION: if you end the command line with a '&', the command is started
6868651Skrisas daemon. This is NOT the same as in normal shell, where the '&' puts a
69280304Sjkimprocess in background. Here the newly started process is totally dissociated
70280304Sjkimfrom terminal.
71280304Sjkim
72280304SjkimPrompt tells you:
73280304Sjkim* your `pwd`
7468651Skris* your PID
7568651Skris* and that you are root ('#').
7668651Skris
7768651SkrisWARNING: this pseudo-shell doesn't do any expansion whatsoever.
7868651Skris
7968651SkrisTo do list
8068651Skris----------
8168651Skris
8268651Skris- oinit proper:
8368651Skris	* fix signal handling and transitions,
8468651Skris	* invent a one-file configuration database (combining as many files
8589837Skris	  from /etc as possible into one) able to properly handle inter-
8668651Skris	  dependencies in running various daemons,
8768651Skris	* allow for interpreting of such database, and running various
8868651Skris	  programs ourselves (this would eventually allow to make /bin/sh
8968651Skris	  an option, not necessity),
90280304Sjkim	* better hooks for incorporating other modules into oinit (see e.g.
91280304Sjkim	  the telnet() below),
9268651Skris	* add optional authentication,
9368651Skris
94273149Sjkim- shell():
95273149Sjkim	* more built-ins: perhaps 'kill' and 'ps',
96273149Sjkim	* variable expansion,
97280304Sjkim	* globbing,
98	* conditionals,
99	* history? (it depends on how much memory it needs).
100	* programmatic hooks for easy customisation of user interface (like
101	  hierarchy of commands and contexts),
102	* ...
103
104- implement as a routine (like shell()) a small remote login daemon telnet(),
105  as a built-in module to oinit. It would implement the simplest options of
106  normal telnet, and would itself handle authentication, passing control to
107  shell() on success. The authentication routine would be the same as for
108  checking console access.
109
110And allow me for a moment of day-dreaming: I'd like to rewrite oinit one day
111to be a monolithic one-in-all application, non-forking but multithreaded... It
112would contain all the modules, such as shell(), telnet(), ifconfig() etc...
113started as threads, not separate processes.
114
115Credits
116-------
117
118The overall framework was taken from FreeBSD /sbin/init.
119
120Andrzej Bialecki
121<abial@freebsd.org>
122
123$FreeBSD: head/release/picobsd/tinyware/oinit/README 50479 1999-08-28 01:35:59Z peter $
124