1 # Copyright (C) 2009 Andy Spencer
2 # See COPYING for terms
5 PATH=/lib/mkinit/bin:/bin:/sbin:/usr/bin:/usr/sbin
6 MKSHELL=/usr/lib/plan9/bin/rc
10 #start-test:VQPservice -u: start-foo
14 #stop-test:VQPservice -d: /
19 # Make getty wait (for bootchart)
22 user:V: system `{echo start-^(alsa keymap polipo spam)}
23 system:V: bare `{echo start-^(at cron hddtemp hostname hwclock i8k sshd swap syslog)}
24 bare:V: `{echo start-^(cpufreq fsclean getty localhost modules mounts uevents)}
26 # Initial setup/shutdown for mkinit
27 boot:QVEPservice -u: /
29 $P mount -o remount,rw /
30 # mount proc here to make bootchart happier
31 $P mount -t proc proc /proc
32 rm -f /lib/mkinit/state/*
35 # Kill all process, then remount and sync
36 halt:QVE: stop-utmp stop-hwclock stop-alsa
38 rm -f /lib/mkinit/state/*
40 echo TERMinating all processes
43 $P pgrep -vg0 >/dev/null && $P sleep 1
45 echo KILLing all processes
48 $P pgrep -vg0 >/dev/null && $P sleep 1
50 $P mount -o remount,ro /
53 # Proc, mtab, udev, fstab
54 start-mounts:QVPservice -u: boot
56 $P cat /proc/mounts > /etc/mtab
62 start-modules:QVEPservice -u: boot
67 # Trigger udev uevents
68 start-uevents:QVEPservice -u: start-mounts
71 $P udevadm settle '--timeout=10'
74 # Clean out /tmp and /var/run directories
75 start-fsclean:QVPservice -u: boot
81 # Spawn gettys for tty[456]
82 start-getty:QVPservice -u: start-hostname start-utmp
84 $P respawn /sbin/agetty 38400 tty4 linux &
85 $P respawn /sbin/agetty 38400 tty5 linux &
86 $P respawn /sbin/agetty 38400 tty6 linux &
89 # Spawn qingys for tty[23]
90 start-qingy:QVPservice -u: start-hostname start-utmp start-modules start-uevents
92 $P respawn /sbin/qingy tty2 &
93 $P respawn /sbin/qingy tty3 &
97 start-utmp:QVPservice -u: start-fsclean
99 for (i in /var/run/utmp /var/log/wtmp) {
105 utmp_stop_cmd=halt -w
108 start-cpufreq:QVPservice -u: start-uevents
109 echo Starting cpufreq
110 cpufreq-set -g ondemand
113 # Keymap (us-cc = us with ctrl-capslock switched)
114 keymap_start_cmd=loadkeys -u us-cc
117 localhost_start_cmd=ifconfig lo 127.0.0.1
118 localhost_stop_cmd=ifconfig lo down
121 hostname_start_cmd=hostname b
124 sysctl_start_cmd=sysctl -p
131 hwclock_start_cmd=hwclock --hctosys --utc
132 hwclock_stop_cmd=hwclock --systohc --utc
133 swap_start_cmd=swapon -a
134 swap_stop_cmd=swapoff -a
135 start-syslog:QVPservice -u: start-mounts
136 echo Starting syslog;
139 start-hddtemp:QVPservice -u: start-localhost
140 echo Starting hddtemp
141 $P hddtemp -d -l 127.0.0.1 /dev/sda
143 hddtemp_stop_cmd=pkill hddtemp
148 alsa_start_cmd=alsactl restore
149 alsa_stop_cmd=alsactl store
150 sshd_start_cmd=/usr/sbin/sshd
151 start-spam:QVPservice -u: start-localhost
155 start-polipo:QVPservice -u: start-localhost
159 polipo_stop_cmd=pkill polipo
164 start-%:QVPservice -u: boot
165 if (~ $#($stem^_start_cmd) 0)
168 $P $($stem^_start_cmd)
171 stop-%:QVPservice -d: /
172 if (~ $#($stem^_stop_cmd) 0)
175 $P $($stem^_stop_cmd)
178 zap-%:QVPservice -d: /