README revision 40813
11573SrgrimesWarsaw, 1998.07.07
21573Srgrimes
31573SrgrimesThis README shortly describes the features of "oinit" - a very simplistic
4264042Stheravenversion of init(8) combined with a shell.
5264042Stheraven
61573SrgrimesFeatures
71573Srgrimes--------
81573Srgrimes
91573Srgrimes* oinit is able to run system in multi- and single-user modes,
101573Srgrimes* it can be started on system with DEVFS/SLICE (i.e. empty /dev),
111573Srgrimes* provides minimalistic user interface, called "shell()",
121573Srgrimes* it can run the system startup script (/etc/rc),
131573Srgrimes* it can be compiled with -DOINIT_RC to use its own startup script
141573Srgrimes  (*very* primitive, but doesn't require any real shell to run it!),
151573Srgrimes* doesn't require the whole chain of init->getty->login->shell to be run,
161573Srgrimes* it is extremely small, and is ideally suited for situations when
171573Srgrimes  there is little memory.
18251069Semaste
191573SrgrimesAs an additional bonus you receive some obvious and some hidden bugs... :-))
201573SrgrimesThis code is at most alpha quality yet.
211573Srgrimes
221573Srgrimes
231573SrgrimesHow it works
241573Srgrimes------------
251573Srgrimes
261573SrgrimesUnlike normal init(8), it forks itself on given number of vty's immediately
271573Srgrimesproviding shell() interface. Currently it doesn't require (and is unable to
281573Srgrimesperform) any authentication, but this is easy to add if needed.
291573Srgrimes
301573SrgrimesStandard version of FreeBSD kernel looks for /sbin/init first, and then
311573Srgrimestries to execute it. If it fails, it tries to find:
321573Srgrimes	/sbin/oinit
331573Srgrimes	/sbin/init.bak
341573Srgrimes	/stand/sysinstall
351573Srgrimes
361573SrgrimesSo it is easy to make use of it even on standard system - just put it in
371573Srgrimes/sbin/oinit and rename /sbin/init to something else, e.g. /sbin/init.bak.
3892889Sobrien
3992889Sobrien+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
401573Srgrimes!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
411573Srgrimes+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4215312SbdeInit (or oinit) plays crucial role in the system. If you plan to do any
431573Srgrimeschanges to your system's init, make sure you have a boot floppy with working
441573Srgrimesversion of statically compiled init(8) on it - you can very easily put your
45264042Stheravensystem in unusable state when fiddling with it.
46264042Stheraven+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47264042Stheraven
48264143StheravenShell() interface
49264042Stheraven-----------------
50264042Stheraven
51264042StheravenIt allows you to issue built-in and external commands. Built-in commands
52264042Stheravenare listed below. For each command there is short help available, with
531573Srgrimesexample of usage.
541573Srgrimes
551573Srgrimes	cd	change working directory
561573Srgrimes	pwd	print working directory
571573Srgrimes	set	set environment variable (no expansion)
581573Srgrimes	unset	unset environment variable
591573Srgrimes	env	print all environment variables
601573Srgrimes	echo	echo arguments on stdout
611573Srgrimes	exit	exit from shell (oinit will start a new one after some delay)
621573Srgrimes	.	source-in a file with commands
631573Srgrimes	?	help
641573Srgrimes
651573SrgrimesAny other command is passed to execvp(3) as it is.
661573Srgrimes
671573SrgrimesEXCEPTION: if you end the command line with a '&', the command is started
681573Srgrimesas daemon. This is NOT the same as in normal shell, where the '&' puts a
691573Srgrimesprocess in background. Here the newly started process is totally dissociated
701573Srgrimesfrom terminal.
711573Srgrimes
721573SrgrimesPrompt tells you:
731573Srgrimes* your `pwd`
741573Srgrimes* your PID
751573Srgrimes* and that you are root ('#').
761573Srgrimes
771573SrgrimesWARNING: this pseudo-shell doesn't do any expansion whatsoever.
781573Srgrimes
791573SrgrimesTo do list
801573Srgrimes----------
811573Srgrimes
821573Srgrimes- oinit proper:
831573Srgrimes	* fix signal handling and transitions,
841573Srgrimes	* invent a one-file configuration database (combining as many files
851573Srgrimes	  from /etc as possible into one) able to properly handle inter-
861573Srgrimes	  dependencies in running various daemons,
871573Srgrimes	* allow for interpreting of such database, and running various
881573Srgrimes	  programs ourselves (this would eventually allow to make /bin/sh
891573Srgrimes	  an option, not necessity),
90264042Stheraven	* better hooks for incorporating other modules into oinit (see e.g.
911573Srgrimes	  the telnet() below),
921573Srgrimes	* add optional authentication,
931573Srgrimes
941573Srgrimes- shell():
95264042Stheraven	* more built-ins: perhaps 'kill' and 'ps',
961573Srgrimes	* variable expansion,
971573Srgrimes	* globbing,
981573Srgrimes	* conditionals,
991573Srgrimes	* history? (it depends on how much memory it needs).
1001573Srgrimes	* programmatic hooks for easy customisation of user interface (like
1011573Srgrimes	  hierarchy of commands and contexts),
1021573Srgrimes	* ...
1031573Srgrimes
1041573Srgrimes- implement as a routine (like shell()) a small remote login daemon telnet(),
1051573Srgrimes  as a built-in module to oinit. It would implement the simplest options of
1061573Srgrimes  normal telnet, and would itself handle authentication, passing control to
1071573Srgrimes  shell() on success. The authentication routine would be the same as for
1081573Srgrimes  checking console access.
1091573Srgrimes
1101573SrgrimesAnd allow me for a moment of day-dreaming: I'd like to rewrite oinit one day
1111573Srgrimesto be a monolithic one-in-all application, non-forking but multithreaded... It
1121573Srgrimeswould contain all the modules, such as shell(), telnet(), ifconfig() etc...
1131573Srgrimesstarted as threads, not separate processes.
1141573Srgrimes
1151573SrgrimesCredits
1161573Srgrimes-------
1171573Srgrimes
1181573SrgrimesThe overall framework was taken from FreeBSD /sbin/init.
1191573Srgrimes
1201573SrgrimesAndrzej Bialecki
121264042Stheraven<abial@freebsd.org>
1221573Srgrimes
1231573Srgrimes$Id: README,v 1.1.1.1 1998/08/27 17:38:45 abial Exp $
1241573Srgrimes