Description
===========

This set of scripts can be used to boot up or shut down a Linux system.
It is derived from r2d2 (http://www.shop.de/linux/local/) version 0.5.8.

I corrected some bugs and changed a few things. In particular I renamed
runlevel.cfg to Runlevel.cfg, changed the path from /etc/init.d to
/etc/rc.d, and removed the first column from Runlevel.cfg which was
unused (and not useful anyway).

This test release is more flexible when configuring network and serial
interfaces. It still lacks a completely flexible configuration for
ISDN devices and MD devices (and for anything I don't currently use).

The file rc.d/System.defs has been replaced by several small files in
the new directory sysconfig (similar to what Red Hat does).

I decided to have all files that need user configuration start with a
capital letter and all others start with small letters. This makes it easy
to copy a new set of scripts to a machine without destroying the
machine specific configuration.

So the configurable files are:

Local		Local configuration, rarely used
sysconfig/*	Variables that describe the setup of a Linux box completely.
		I haven't yet achieved this goal fully but it's a start.
		Note that I still rely on other configuration files like
		/etc/fstab and /etc/mdtab but I don't think this is bad.
Networks	Describes the networks and interfaces to set up,
		one per line.
Uarts		Describes the serial interfaces to configure, one per line.
Runlevel.cfg	This is simply a table that describes what scripts get
		executed in what order when the runlevel changes.

If you encounter problems you could also look at the file 'constants'.

These scripts is tested with sysvinit 2.57 and later. It should work
with other versions and other inits, too (untested).

How to install
==============

0. Make sure you can boot your system via the command line 'init=/bin/sh rw'
   at the LILO prompt. You will need it to fix initial problems with the boot
   scripts.
1. Copy /etc/inittab to a safe place.
2. Merge Inittab.sample with your existing inittab.
   Remove or comment out all lines that start the old init scripts.
3. Move /etc/rc.d (if it exists) to a safe place. Move it rather than copying
   it to make sure no obsolete files remain. Do the same with /etc/sysconfig
   if it exists. Note that both may be a symlink, in which case you simply
   remember where they point to and then delete them.
4. Copy the contents of this archive to /etc/rc.d and /etc/sysconfig.
5. Adapt sysconfig/* and Runlevel.cfg to your system. See below.
6. mount -a -o remount,ro
7. init q
   This may fail to unmount your disks correctly but don't worry. It's
   never easy to switch to a new set of boot scripts. Just test if it boots
   up correctly. If it doesn't, fix it until it does.

Why another set of boot scripts?
================================

I have a network of computers and want to minimize the amount of work
needed to keep their boot scripts up to date.

My goal is to create a set of scripts which is identical for each
computer regardless of what services run on it. Only a few files as
described above define the setup of a computer completely. You enable
or disable services (or drivers) in Runlevel.cfg and configure then
in /etc/sysconfig (similar to Red Hat's /etc/sysconfig). Runlevel.cfg
additionally defines the order in which the services are started.

Obviously, BSD style boot scripts are not flexible enough for easy
configuration. On the other hand, SysV boot scripts are a complete
mess.

Distributions like RedHat and SuSE do it the SysV way but I use
neither of them. Then there's r2d2 which is compatible with these
distributions and simplifies a lot of things. But I think I can do
even better.

I plan to integrate cron, profile (aliases, environment) and logfile
configuration to some extent into this package. This needs some more thought,
though.

Description of the boot scripts
===============================

Each script is listed as mandatory or optional. Optional means that it can
safely be commented out in Runlevel.cfg; mandatory means you'd better know
what you're doing.

acct (optional)
Starts/stops BSD process accounting.
Works only with Linux 1.3/2.0 or 2.1/2.2. It assumes the program accton is in
the path.

apache (optional)
Starts/stops Apache 1.3.0 or later.

apache1.2 (optional)
Starts/stops Apache 1.2.x or earlier (or CERN httpd).
Assumes httpd is in the ${NET} directory (OK).
If stopping httpd doesn't work, try making a link from the PID file
to ${RUN}/httpd.pid.

batch (optional)
Starts/stops batch jobs in the background.
This file is very specific for my personal setup. It assumes that in the
directory ${WORK} files with extensions .check exist and contain commands
to start the actual work.

bb (optional)
Starts/stops Big Brother.
Assumes the variable ${BB_DIR} is set (use /etc/sysconfig/bb).

beroftpd (optional)
Starts/stops BeroFTPD.
Assumes BeroFTPD is in ${NET} and creates PID file ${RUN}/ftpd.pid (OK).

cdmount (optional)
Mounts/unmounts CDs.
Relies on /etc/fstab to find CDs. It is not needed if you don't have CD-ROM
drives or don't want CDs to be mounted during boot.
Use only if you have CD-ROM drives since it loads the iso9660 module
unconditionally.

cfd (optional)
Starts/stops cfd, the cfengine daemon.
Assumes the CFINPUTS environment variable is correctly set.

color (optional)
Start only: Sets colors for the virtual terminals.
The number of VTs and the colors should be configurable so this file is really
a wart. It also sets console blanking which doesn't belong here. Probably a
config file VT is needed.

console (optional)
Start only: Sets video mode and font.

constants (mandatory)
Configuration which might need tuning for a site. Once it's defined it
shouldn't be necessary to change anything in this file again.

cron (optional)
Starts/stops cron and atd.
Assumes these programs live in ${NET} and are called cron and atd,
respectively. Assumes they create run files ${RUN}/cron.pid and ${RUN}/atd.pid,
respectively. This works with Vixie Cron, but is untested with others.

delegated (optional)
Starts/stops delegated.
Hack: Assumes delegated lives in ${NET} and creates the PID file
/tmp/delegate/pid/83. Options are fixed.

dhcpd (optional)
Starts/stops dhcpd.
Assumes dhcpd lives in ${NET} and creates the PID file ${RUN}/dhcpd.pid.

eclipse (optional)
Starts/stops the eclipse client.
Assumes eclipse is somewhere in the search path.
Puts output in /var/log/eclipse_client.run.

filecache (optional)
Starts/stops filecache.
A hack to test the filecache kernel patch. It turned out that this has far too
many shortcomings to be useful to me, but feel free to experiment yourself.

forward (optional)
Starts/stops IP forwarding.

functions (mandatory)
One of the scripts that make this all work.

halt (mandatory)
Program that halts the system. Not in /bin or /sbin to avoid accidents.

hostname (mandatory)
Start only: Set the hostname.

hylafax (optional)
Starts/stops hylafax.
Assumes that faxq is somewhere in the path.

inet (mandatory)
Start only: Attaches the loopback device
You can only disable this if you have networking disabled (which you shouldn't).

inetd (optional)
Starts/stops inetd.
Assumes inetd lives in ${NET} and creates the PID file ${RUN}/inetd.pid (OK).

inn (optional)
Starts/stops INN.
Calls rc.news in the ${NEWS_RC} directory. Calls ctlinnd in the ${NEWS_BIN}
directory.

ipac (optional)
Start only: Starts IP accounting, using the ipac package.
Assumes ipacset is in the path.
TODO: stop

ipacct (optional)
Starts/stops IP accounting.
Uses only one rule per network, counting the total packets on this network.
Uses the file Networks.

ipfilter (optional)
Starts/stops packet filtering. This is a hack that currently can only be
configured by editing the file.

iprofd (optional)
Starts/stops iprofd.
Assumes iprofd is in /sbin, and the profile in /etc/isdn.profile.

ipx (optional)
Starts/stops IPX networking.
Assumes there is only one IPX interface. Assumes ipx_interface and ipx_route
are in the path.

isdn (optional)
Starts/stops ISDN networking.
Quite a hack, not configurable yet.

isdnacct (optional)
Starts/stops ISDN accounting.
Assumes there's only one ISDN interface and counts only the total packets on
this interface.

isdnlog (optional)
Starts/stops isdnlog.
Assumes isdnlog is in the path and creates PID file
${RUN}/isdnlog.isdnctrl0.pid (OK).
Also assumes there is only one ISDN interface.

issue (optional)
Start only: Creates an /etc/issue file.

junkbuster (optional)
Starts/stops junkbuster.
Assumes junkbuster is in the path (OK).

keymap (optional)
Start only: Configures the keyboard.
Assumes setleds, loadkeys, and cursor (if available) are in the path (OK).

kernel-nfsd (optional)
Starts/stops the kernel NFS daemon (Linux 2.2 and up).
Assumes exportfs, rpc.mountd and rpc.nfsd are in ${NET} (OK).

lpd (optional)
Starts/stops lpd.
Assumes lpd is in ${NET} (OK).

mars_nwe (optional)
Starts/stops mars_nwe.
Assumes nwserv is in ${MARS_NWE_BIN} or in the path (OK).

masq (optional)
Starts/stops IP masquerading.
Sets up masquerading for each network in Networks.

md (optional)
Starts/stops MD partitions.
A hack that has all devices hardcoded.

mdtest (optional)
Starts/stops MD partitions.
Experimental script to read /etc/mdtab. Not working correctly yet.

modules (optional)
Starts/stops kerneld.
Also loads the module unix if it exists.

motd (optional)
Start only: Creates /etc/motd.
Assumes the program /usr/local/bin/yow exists.

mouse (optional)
Starts/stops gpm.
Doesn't load driver modules that might be necessary.

mysql (optional)
Starts/stops mysqld.
Assumes safe_mysqld and mysqladmin are in the path (OK).

named (optional)
Starts/stops named.
Assumes named is in ${NET} (OK).

nas (optional)
Starts/stops au.
Assumes au is in the path (including X11).

network (optional)
Starts/stops networking.
Uses the Networks file.

nfs (optional)
Mounts/unmounts NFS filesystems.
Uses /etc/fstab.

nfsd (optional)
Starts/stops the NFS daemon.
Assumes rpc.mountd and rpc.nfsd are in ${NET} (OK).

nut (optional)
Starts/stops the Network UPS Tools daemon.

panic (optional)
Start only: Sets the kernel panic delay.

portmap (optional)
Starts/stops the portmapper.
Assumes rpc.portmap is in the path (OK).

postgresql (optional)
Starts/stops postmaster.
Assumes postmaster is in ${PG_BIN}/postmaster and must run as user 'postgres'
(OK). Uses options ${PG_OPTIONS}.

proftpd (optional)
Starts/stops proftpd.
Assumes proftpd lives in ${NET} and creates the PID file ${RUN}/proftpd-<pid>
(OK).

quota (optional)
Starts/stops quotas.
Assumes quotaon and quotaoff are in the path (OK).

r2d2 (mandatory)
This script starts it all.

raid (optional)
Starts RAID. This is currently a hack, only configurable by editing the
script.

rc.0 (mandatory)
Calls halt.

rc.6 (mandatory)
Calls reboot.

rcdefs (mandatory)
This script includes the other config scripts: constants, functions, and
System.defs.

rmlocks (mandatory)
Removes stale lock files.

rstatd (optional)
Starts/stops rpc.rstatd.
Assumes rpc.rstatd is in ${NET} (OK).

sendmail (optional)
Starts/stops sendmail.
Assumes sendmail is in ${NET}.

serial (optional)
Start only: Configures serial ports.
Uses the file Uarts.

single (mandatory)
Start only: Filesystem check, mounting, configuring clock, making module
dependencies, removing old files.

smupsd (optional)
Starts/stops smupsd.
Assumes smupsd is in ${NET} (OK).

snmp (optional)
Starts/stops SNMP (CMU only?)
Assumes snmpd is in the path (OK).

squid (optional)
Starts/stops squid.

sshd (optional)
Starts/stops sshd.
Assumes sshd is in the path (OK).

stop (mandatory)
Stop only: Prepares the system for halt/reboot.
Assumes ctrlaltdel and sync are in /bin or /sbin (OK).

swap (mandatory for most machines)
Starts/stops swapping.
Assumes swapon and swapoff are in /sbin (OK).

syslogd (mandatory for most machines)
Starts/stops syslogd and klogd.
Assumes syslogd and klogd are in ${NET} and create PID files in ${RUN} (OK).

thttpd (optional)
Starts/stops thttpd.
Assumes thttpd is in the path (OK).

timed (optional)
Starts/stops timed.
Assumes timed is in ${NET} (OK).

xfs (optional)
Starts/stops a font server.

xinetd (optional)
Starts/stops xinetd.
Assumes xinetd is in ${NET} (OK).

xntpd (optional)
Starts/stops xntpd.
Assumes xntpd is in ${NET} (OK).
