# echo stopping test
# service -D $target
-# Runlevels
-user = alsa keymap polipo spam dbus
-system = at cron hddtemp hostname hwclock i8k sshd swap syslog
-bare = cpufreq fsclean getty qingy localhost modules mounts uevents utmp
-
-default:V: user
-
-user:V: `{echo $user^-start $system^-start $bare^-start}
-system:V: `{echo $user^-stop $system^-start $bare^-start}
-bare:V: `{echo $user^-stop $system^-stop $bare^-start}
-single:V: `{echo $user^-stop $system^-stop $bare^-stop }
+# Runlevels:
+# single─bare─system─┬─desktop─>
+# └─server──>
+server = apache2
+desktop = alsa cups dbus keymap polipo
+system = at cron hddtemp hwclock sshd swap syslog
+bare = cpufreq fsclean getty qingy hostname initctl localhost modules mounts uevents utmp
+
+default:V: desktop
+
+server:V: `{echo $server^-start $system^-start $bare^-start}
+desktop:V: `{echo $desktop^-start $system^-start $bare^-start}
+system:V: `{echo $server^-stop $desktop^-stop $system^-start $bare^-start}
+bare:V: `{echo $server^-stop $desktop^-stop $system^-stop $bare^-start}
+single:V: `{echo $server^-stop $desktop^-stop $system^-stop $bare^-stop }
poweroff:V: halt
$P poweroff -ndf
$P reboot -ndfk
# Initial setup/shutdown for mkinit
-boot:QVEPservice -u: /
+boot:VEPservice -u: /
echo Starting init
$P mount -o remount,rw /
# mount proc here to make bootchart happier
$P mount -t proc proc /proc
- rm -f /lib/mkinit/state/*
+ service -F
service -U $target
# Kill all process, then remount and sync
halt:QVE: utmp-stop hwclock-stop alsa-stop
- echo Stopping init
- rm -f /lib/mkinit/state/*
-
echo TERMinating all processes
- $P pkill -15 -vg0
+ $P pkill -15 -vg0 >/dev/null >[2=1]
for (i in 1 2 3 4 5)
- $P pgrep -vg0 >/dev/null && $P sleep 1
-
+ $P pgrep -vg0 >/dev/null >[2=1] && $P sleep 1
echo KILLing all processes
- $P pkill -9 -vg0
+ $P pkill -9 -vg0 >/dev/null >[2=1]
for (i in 1 2 3)
- $P pgrep -vg0 >/dev/null && $P sleep 1
-
+ $P pgrep -vg0 >/dev/null >[2=1] && $P sleep 1
+ service -F
+ echo Remounting read-only
$P mount -o remount,ro /
$P sync
# Bare
# ----
+# Listener for /dev/initctl, for shutdown(8)
+initctl-start:VPservice -u: boot
+ fifo=/dev/initctl
+ if (! test -e $fifo)
+ $P mkfifo $fifo
+ { exec $P initctld $fifo |
+ while(line=`{line})
+ $P mkinit $line >/dev/console >[2=1]
+ } &
+ service -U $target
+initctl-stop_cmd=fuser -k /dev/initctl
+
# Proc, mtab, udev, fstab
-mounts-start:QVPservice -u: boot
- echo Starting mounts
- $P cat /proc/mounts > /etc/mtab
+mounts-start:VPservice -u: boot
+ $P cp /proc/mounts /etc/mtab
$P udevd --daemon
- $P mount -a
+ $P mount -a
service -U $target
# Load kernel modules
-modules-start:QVEPservice -u: boot
- echo Starting modules
+modules-start:VEPservice -u: boot
$P modprobe uvesafb
service -U $target
# Trigger udev uevents
-uevents-start:QVEPservice -u: mounts-start
- echo Starting uevents
+uevents-start:VEPservice -u: mounts-start
$P udevadm trigger
$P udevadm settle '--timeout=10'
service -U $target
# Clean out /tmp and /var/run directories
-fsclean-start:QVPservice -u: boot
- echo Starting fsclean
- $P rm -rf /tmp/*
- $P rm -rf /var/run/*
+fsclean-start:VPservice -u: boot
+ dirs=(/var/run /tmp)
+ $P mkdir -p /.old
+ $P mv $dirs /.old
+ $P mkdir -p $dirs
+ $P chmod 1777 /tmp
+ $P exec rm -rf /.old &
service -U $target
# Spawn gettys for tty[456]
-getty-start:QVPservice -u: hostname-start utmp-start
- echo Starting getty
- $P respawn /sbin/agetty 38400 tty4 linux &
- $P respawn /sbin/agetty 38400 tty5 linux &
- $P respawn /sbin/agetty 38400 tty6 linux &
+getty-start:VEPservice -u: hostname-start utmp-start
+ $P respawn /sbin/agetty 38400 tty4 linux
+ $P respawn /sbin/agetty 38400 tty5 linux
+ $P respawn /sbin/agetty 38400 tty6 linux
service -U $target
-getty-stop_cmd=pkill agetty
+getty-stop_cmd=fuser -k /dev/tty4 /dev/tty5 /dev/tty6
# Spawn qingys for tty[23]
-qingy-start:QVPservice -u: hostname-start utmp-start modules-start uevents-start
- echo Starting qingy
- $P respawn /sbin/qingy tty2 &
- $P respawn /sbin/qingy tty3 &
+qingy-start:VEPservice -u: hostname-start utmp-start modules-start uevents-start
+ $P respawn /sbin/qingy tty2
+ $P respawn /sbin/qingy tty3
service -U $target
-getty-stop_cmd=pkill qingy
+qingy-stop_cmd=fuser -k /dev/tty2 /dev/tty3
# Login records
-utmp-start:QVPservice -u: fsclean-start
- echo Starting utmp
+utmp-start:VPservice -u: fsclean-start
for (i in /var/run/utmp /var/log/wtmp) {
- echo -n > $i
- chgrp utmp $i
- chmod 0664 $i
+ $P eval 'echo -n > $i'
+ $P chgrp utmp $i
+ $P chmod 0664 $i
}
service -U $target
utmp-stop_cmd=halt -w
# CPU freq
-cpufreq-start:QVPservice -u: uevents-start
- echo Starting cpufreq
- cpufreq-set -g ondemand
+cpufreq-start:VPservice -u: uevents-start
+ $P cpufreq-set -g ondemand
service -U $target
-# Keymap (us-cc = us with ctrl-capslock switched)
-keymap-start_cmd=loadkeys -u us-cc
-
# Localhost
localhost-start_cmd=ifconfig lo 127.0.0.1
localhost-stop_cmd=ifconfig lo down
sysctl-start_cmd=sysctl -p
-# Console
+# System
# -------
at-start_cmd=atd
at-stop_cmd=pkill atd
cron-start_cmd=cron
cron-stop_cmd=pkill cron
+hddtemp-start:VPservice -u: localhost-start
+ $P hddtemp -d -l 127.0.0.1 /dev/sda
+ service -U $target
+hddtemp-stop_cmd=pkill hddtemp
+
hwclock-start_cmd=hwclock --hctosys --utc
hwclock-stop_cmd=hwclock --systohc --utc
+sshd-start_cmd=/usr/sbin/sshd
+sshd-stop_cmd=pkill sshd
+
swap-start_cmd=swapon -a
swap-stop_cmd=swapoff -a
-syslog-start:QVPservice -u: mounts-start
- echo Starting syslog;
+syslog-start:VPservice -u: mounts-start
$P syslog-ng
service -U $target
syslog-stop_cmd=pkill syslog
-hddtemp-start:QVPservice -u: localhost-start
- echo Starting hddtemp
- $P hddtemp -d -l 127.0.0.1 /dev/sda
- service -U $target
-hddtemp-stop_cmd=pkill hddtemp
-
# Desktop
# -------
alsa-start_cmd=alsactl restore
alsa-stop_cmd=alsactl store
-sshd-start_cmd=/usr/sbin/sshd
-sshd-stop_cmd=pkill sshd
+cups-start_cmd=cupsd
+cups-stop_cmd=pkill cupsd
-dbus-start:QVPservice -u: localhost-start
- echo Starting dbus
- $P /usr/bin/dbus-daemon -- --system
+dbus-start:VPservice -u: fsclean-start localhost-start
+ $P mkdir -p /var/run/dbus
+ $P /usr/bin/dbus-daemon --system
service -U $target
dbus-stop_cmd=pkill dbus-daemon
-spam-start:QVPservice -u: localhost-start
- echo Starting spam
- $P spamd -d
- service -U $target
-spam-stop_cmd=pkill spamd
+keymap-start_cmd=loadkeys -u us-cc
-polipo-start:QVPservice -u: localhost-start
- echo Starting poliop
+polipo-start:VPservice -u: localhost-start
$P polipo
service -U $target
polipo-stop_cmd=pkill polipo
+# Server
+# ------
+apache2-start_cmd=apache2 -DSSL -DPHP5
+apache2-stop_cmd=pkill apache2
+
+spam-start:VPservice -u: localhost-start
+ $P spamd -d
+ service -U $target
+spam-stop_cmd=pkill spamd
+
# Library
# -------
-%-start:QVPservice -u: boot
+%-start:VPservice -u: boot
if (~ $#($stem^-start_cmd) 0)
exit 0
- echo Starting $stem
$P $($stem^-start_cmd)
service -U $target
-%-stop:QVPservice -d: /
+%-stop:VPservice -d: /
if (~ $#($stem^-stop_cmd) 0)
exit 0
- echo Stopping $stem
$P $($stem^-stop_cmd)
service -D $target
-%-zap:QVPservice -d: /
+%-zap:VPservice -d: /
service -D $target
-%-status:QV:
+%-status:V:
service -q $target