
Vector Linux Init (experimental)
================================

This is a new proposed VL Init procedures. 
It combines the best from Slackware's ortodox init scripts 
and sys-v init system.

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 vbootset.

Among the main advantages are
1. updated rc.S for system initialisation, allow udev (kernel 2.6)
2. advanced hardwares and network, are not launched when you boot into 
   singleuser mode.  Allowing you to avoid system lock and do maintenance.
3. hardware, network, network file system are initialized only once when 
   goes to multiuser mode. You can switch run level 2/3/4/5 without 
   reinitialising them.
4. keeps servers running when switching level 3/5 but kills X-window.
5. keeps X-windows running when swithing level 4/5 but kills servers.
6. optional vlinit that does not kill/restart unnecessary services when
   switching run level like sysvinit does.

In short, this is a FAST run level switching system.   
You can't find many of these feature in the leading distros !

Thats enough for everyday users.
Read on if you are a geek :)

/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.
Hardware can be set up using VASM-vhwset.
Network by using vnetmenu or VASM-vnetconf.

/etc/rc.d/rc.X
-----------------
Start the GUI login, either KDM, GDM, WDM or XDM.
It will bounce back to run level 2 or 3 if X is failed to launch. 
Can be setup by using VASM-vxdmset.

/etc/rc.d/rc.init
-----------------
Runs on each run level switching.
Calls rc.sysvinit or rc.vlinit to start/kill services.
Can be setup by using VASM-vinitset

sysvinit is the standard, while vlinit is the proposed new system.
Both sysvinit and vlinit use the same service registration.
To register a service in a run level use VASM-vsrvset.
From command line, you may use
  /sbin/service -s service_name runlevels [run_order]
  /sbin/service -r service_name runlevels

/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.

/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
- faster switching. It does not kill a service if not necessary.
  Only reload it.
- internally, uses only start (S??) symlinks for service registration.
  (but for compatibility Kill (K??) symlinks are still there)
- more simple and sensible

/etc/rc.d/rc.keymap, rc.fonts
-----------------------------------------------------------------
Various hardware 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, rc.inet2 ... rc.inet9
--------------------------------------------------
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.router
--------------------------------------------------
Setting up routing table.
Currently none. But if you make it it will be executed.

/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 ;-)


/etc/initab 
-----------------------
Well, this is the trick.
You may take a look but don't play with it unless you know what you are doing.
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)


WRITING a service script
--------------------------------------------------
Service script is the one that actually start or stop the service
(like sshd, samba, cups, etc). The service scripts are located under
/etc/rc.d/init.d. They 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.
  Start/stop are mandatory for sysvinit and vlinit.
  Attention please, reload is also a must for vlinit.
- 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 (start)
- killproc (stop)
- reloadproc (reload)
- evaluate_retval

-----------------------------------
Happy hacking
Eko M. Budi, 2004

