Vector Linux Init (experimental)
================================
This is a new proposed VL Init procedures. 

It defines the following run levels:
0 = halt
1 = single user
2 = multiuser, teks desktop
3 = multiuser, teks server
4 = multiuser, GUI desktop
5 = multiuser, GUI server
6 = reboot

The default run level is 2,
but can be changed by using VASM-xboot.

and the main advantages are:
- keep servers running when switching from level 3 to 5
- keep X-windows running when swithing from level 4 to 5
- optional vlinit for faster run level switching

/etc/initab 
-----------------------
Well, this is tricky.
This file defines the scripts that run on each level as follows:

boot single user (1)     --> rc.S
boot multi user (2-3)    --> rc.S, rc.M, rc.init
boot multiuser GUI (4-5) --> rc.S, rc.M, rc.init, rc.X

Switching from single user to multiuser TUI
From (1) to (2/3)    --> rc.M, rc.init

Switching from single user to multiuser GUI
From (1) to (4/5)    --> rc.M, rc.init, rc.X

Switching in TUI mode.
From (2/3) to (3/2)  --> rc.init (rc.M remains)

Switching from TUI to GUI.
From (2-3) to (4-5)  --> rc.init, rc.X

Switching in GUI mode.
From (4/5) to (5/4)  --> rc.init  (rc.M and rc.X remain)

Switching BACK from GUI to TUI
From (4-5) to (2-3)  --> rc.init  (rc.X quits)

Switching BACK from multiuser to single user
From (2-5) to (1)    --> rc.init, rc.1 (rc.X and rc.M quit)

Switching BACK from multiuser to reboot/halt
From (2-5) to (0/6)  --> rc.init, rc.0 (rc.X and rc.M quit)


/etc/rc.d/rc.S
----------------------------------
This script is executed when the system is booted.
It sets up various basic hardware and system parameters.

/etc/rc.d/rc.0 and rc.6
----------------------------------
Both are the same file (symlinked).
This script is executed when the system goes to level 0 (halt) or 6 (reboot).
It kills ALL daemons, unmount file system, then reboot/halt

/etc/rc.d/rc.1
------------------------------------------------
This scritp is executed when the system goes to run level 1
(single user). It kills ALL daemons and network

/etc/rc.d/rc.M
-----------------
This script run when entering multiuser mode (run level 2-5).
It initialise the hardware, network and mount network file system.

/etc/rc.d/rc.X
-----------------
Start the GUI login, either KDM, GDM, WDM or XDM.
Can be setup by using VASM-xdmset.

/etc/rc.d/rc.init
-----------------
Runs on each run level switching.
Calls rc.sysvinit or rc.vlinit to start/kill services.

sysvinit is the standard, while vlinit is the proposed new system.
Both sysvinit and vlinit use the same service registration at /etc/rc.d/init.d
- Provide the service init script at /etc/rc.d/init.d
- The script must be executable 
- To register a service in a run level, use command:
  /sbin/service -s service_name runlevels [run_order]
- To remove a service, use command:
  /sbin/service -r service_name runlevels
- Or, use VASM-srvmenu

/etc/rc.d/rc.sysvinit
--------------------------------------------------
Normal Sys-V init.
sysvinit switchs level as follows:
- Kills the service in the previous run level.
- Starts the services in the next run level.

If disabled, rc.vlinit will be used.
To disable rc.sysvinit make it un-executable.


/etc/rc.d/rc.vlinit
------------------------------------------------
This scritp is an option to sysvinit.

However, vlinit uses different algorithm when switching level as follows:
- Kills the service in the previous run level that
  is NOT registered in the next level.
- Reload services that has been run in the prev run level.
- Starts the services in the next run level that is NOT
  registered in the previous level

The advantages over the OLD sysvinit
- more simple and sensible
- uses only start (S??) symlinks 
  (but for compatibility Kill (K??) symlinks are still there)
- faster switching. It does not kill a service if not necessary


/etc/rc.d/rc.keymap, rc.fonts
-----------------------------------------------------------------
Various hardwara initialisation, launched by rc.S 


/etc/rc.d/rc.modules, rc.pcmcia, rc.hotplug, rc.alsa, rc.serial
-----------------------------------------------------------------
Various hardwara initialisation, launched by rc.M


/etc/rc.d/rc.inet1 and rc.inet2
--------------------------------------------------
Normal network script, launched by rc.M when entering multiuser mode.

This script is normally created by VASM-netconfig and VASM-netset
To disable, delete or make it unexecutable.

/etc/rc.d/init.d/rc.gateway
--------------------------------------------------
Setting up gateway.
Currently only the default gateway.

/etc/rc.d/init.d/rc.dns
--------------------------------------------------
Setting up hostname, domain name and DNS server

/etc/rc.d/init.d/rc.firewall
--------------------------------------------------
Simple masquerading firewall.
Use it if you don't have a better choice ;-)


WRITING init script
--------------------------------------------------
The init scripts under /etc/rc.d/init.d are called by :
- rc.vlinit or rc.sysviont on run level switching
- service when called by user manually
The service program displays the output as is.
The rc.vlinit and rc.sysvint redirect the output/error to a log file.

Therefore, the scripts should follow the following convention:
- Accept start, stop, restart, reload, status parameter
- Write to stdout/stderror, formatted for a log file
- Return success or failure status

It is recomended to source /etc/rc.d/functions
then use these standard functions
- loadproc
- killproc
- echod
- evaluate_retval

