1 # Copyright (C) 2009 Andy Spencer
2 # See COPYING for terms
5 MKSHELL=/usr/lib/plan9/bin/rc
9 #test-start:VQPservice -u: foo-start
13 #test-stop:VQPservice -d: /
18 user = alsa keymap polipo spam
19 system = at cron hddtemp hostname hwclock i8k sshd swap syslog
20 bare = cpufreq fsclean getty qingy localhost modules mounts uevents utmp
24 user:V: `{echo $user^-start $system^-start $bare^-start}
25 system:V: `{echo $user^-stop $system^-start $bare^-start}
26 bare:V: `{echo $user^-stop $system^-stop $bare^-start}
27 single:V: `{echo $user^-stop $system^-stop $bare^-stop }
36 # Initial setup/shutdown for mkinit
37 boot:QVEPservice -u: /
39 $P mount -o remount,rw /
40 # mount proc here to make bootchart happier
41 $P mount -t proc proc /proc
42 rm -f /lib/mkinit/state/*
45 # Kill all process, then remount and sync
46 halt:QVE: utmp-stop hwclock-stop alsa-stop
48 rm -f /lib/mkinit/state/*
50 echo TERMinating all processes
53 $P pgrep -vg0 >/dev/null && $P sleep 1
55 echo KILLing all processes
58 $P pgrep -vg0 >/dev/null && $P sleep 1
60 $P mount -o remount,ro /
65 # Proc, mtab, udev, fstab
66 mounts-start:QVPservice -u: boot
68 $P cat /proc/mounts > /etc/mtab
74 modules-start:QVEPservice -u: boot
79 # Trigger udev uevents
80 uevents-start:QVEPservice -u: mounts-start
83 $P udevadm settle '--timeout=10'
86 # Clean out /tmp and /var/run directories
87 fsclean-start:QVPservice -u: boot
93 # Spawn gettys for tty[456]
94 getty-start:QVPservice -u: hostname-start utmp-start
96 $P respawn /sbin/agetty 38400 tty4 linux &
97 $P respawn /sbin/agetty 38400 tty5 linux &
98 $P respawn /sbin/agetty 38400 tty6 linux &
100 getty-stop_cmd=pkill agetty
102 # Spawn qingys for tty[23]
103 qingy-start:QVPservice -u: hostname-start utmp-start modules-start uevents-start
105 $P respawn /sbin/qingy tty2 &
106 $P respawn /sbin/qingy tty3 &
108 getty-stop_cmd=pkill qingy
111 utmp-start:QVPservice -u: fsclean-start
113 for (i in /var/run/utmp /var/log/wtmp) {
119 utmp-stop_cmd=halt -w
122 cpufreq-start:QVPservice -u: uevents-start
123 echo Starting cpufreq
124 cpufreq-set -g ondemand
127 # Keymap (us-cc = us with ctrl-capslock switched)
128 keymap-start_cmd=loadkeys -u us-cc
131 localhost-start_cmd=ifconfig lo 127.0.0.1
132 localhost-stop_cmd=ifconfig lo down
135 hostname-start_cmd=hostname b
138 sysctl-start_cmd=sysctl -p
144 at-stop_cmd=pkill atd
147 cron-stop_cmd=pkill cron
149 hwclock-start_cmd=hwclock --hctosys --utc
150 hwclock-stop_cmd=hwclock --systohc --utc
152 swap-start_cmd=swapon -a
153 swap-stop_cmd=swapoff -a
155 syslog-start:QVPservice -u: mounts-start
156 echo Starting syslog;
159 syslog-stop_cmd=pkill syslog
161 hddtemp-start:QVPservice -u: localhost-start
162 echo Starting hddtemp
163 $P hddtemp -d -l 127.0.0.1 /dev/sda
165 hddtemp-stop_cmd=pkill hddtemp
170 alsa-start_cmd=alsactl restore
171 alsa-stop_cmd=alsactl store
173 sshd-start_cmd=/usr/sbin/sshd
174 sshd-stop_cmd=pkill sshd
176 spam-start:QVPservice -u: localhost-start
180 spam-stop_cmd=pkill spamd
182 polipo-start:QVPservice -u: localhost-start
186 polipo-stop_cmd=pkill polipo
191 %-start:QVPservice -u: boot
192 if (~ $#($stem^-start_cmd) 0)
195 $P $($stem^-start_cmd)
198 %-stop:QVPservice -d: /
199 if (~ $#($stem^-stop_cmd) 0)
202 $P $($stem^-stop_cmd)
205 %-zap:QVPservice -d: /