MKSHELL=/opt/plan9/bin/rc
# Example
-#test-start:VQPservice -u: foo-start
-# echo starting test
-# service -U $target
-#
-#test-stop:VQPservice -d: /
-# echo stopping test
-# service -D $target
+test-start:VQPservice -u: foo-start
+ echo starting test
+ service -U $target
+
+test-stop:VQPservice -d: /
+ echo stopping test
+ service -D $target
# Core commands
# -------------
# Reboot commands
-poweroff:V: halt
+poweroff:V: halt
$P poweroff -ndf
reboot:V: halt
$P reboot -ndf
boot:VEPservice -u: /
echo Starting init
$P mount -o remount,rw /
+ $P mount -t tmpfs tmpfs /lib/mkinit/state
# mount proc here to make bootchart happier
$P mount -t proc proc /proc
- service -F
service -U $target
# Kill all process, then remount and sync
$P mkfifo $fifo
{ exec $P initctld $fifo |
while(line=`{line})
- $P mkinit $line >/dev/console >[2=1]
+ $P mkinit $line >/dev/console >[2=1]
} &
service -U $target
initctl-stop_cmd=fuser -k /dev/initctl
# Proc, mtab, fstab
-mounts-start:VPservice -u: boot
- $P mdadm -A /dev/md4 /dev/sd[abc]4
+mounts-start:VPservice -u: $devnodes-start
+ $P mdadm -A /dev/md2 /dev/sd[bcd]2 || true
+ $P ln -snf /proc/self/fd /dev/fd
$P mount -a
service -U $target
-# Mount devtmpfs and shm/pts subfolders
+# Set console font
+font-start_cmd=setfont
+
+# Setup device nodes
devtmpfs-start:VEPservice -u: boot
$P mount /dev
$P mkdir /dev/shm
$P mkdir /dev/pts
service -U $target
-# Start mdev as initial/daemon
-mdev-start:VEPservice -u: mounts-start
+devawk-start:VEPservice -u: devtmpfs-start
+ $P echo /root/bin/dev.awk > /proc/sys/kernel/hotplug
+ $P /root/bin/dev.awk
+ service -U $target
+
+devsh-start:VEPservice -u: devtmpfs-start
+ $P echo /root/bin/dev.sh > /proc/sys/kernel/hotplug
+ $P /root/bin/dev.sh -a
+ service -U $target
+
+mdev-start:VEPservice -u: devtmpfs-start
$P echo /sbin/mdev > /proc/sys/kernel/hotplug
$P mdev -s
service -U $target
-# Start udev and trigger events
udev-start:VEPservice -u: mounts-start
$P udevd --daemon
$P udevadm trigger
udev-stop_cmd=pkill udevd
# Load kernel modules
-modules-start:VEPservice -u: boot
- $P modprobe uvesafb
- $P modprobe evdev
+modules-start:VEPservice -u: mounts-start
+ for (i in `{find /sys/devices -name wakeup -not -path '*PWRBN*'})
+ { $P echo disabled > $i }
+ service -U $target
+
+# Intel graphics card
+intel-start:VEPservice -u: mounts-start
+ $P modprobe i915 'modeset=1'
+ $P modprobe nouveau 'modeset=1'
+ $P echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
+ service -U $target
+
+# Nvidia graphics card
+nvidia-start:VEPservice -u: mounts-start
+ $P modprobe i915 'modeset=1'
+ $P modprobe nouveau 'modeset=1'
+ $P echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
+ $P echo 0 > /sys/class/vtconsole/vtcon1/bind
+ $P modprobe -r nouveau
+ $P modprobe nvidia
+ $P setpci -v -H1 -s '00:01.00' 'BRIDGE_CONTROL=0'
+ service -U $target
+
+# Nouveau graphics card
+nouveau-start:VEPservice -u: mounts-start
+ $P modprobe i915 'modeset=1'
+ $P modprobe nouveau 'modeset=1'
+ $P echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
+ $P echo 0 > /sys/class/vtconsole/vtcon1/bind
+ $P modprobe -r nouveau
+ $P modprobe nouveau 'modeset=1'
service -U $target
# Clean out /tmp and /var/run directories
fsclean-start:VPservice -u: boot
- dirs=(/var/run /tmp)
+ dirs=(/run /var/run /tmp)
$P mkdir -p /.old
$P mv $dirs /.old || true
$P mkdir -p $dirs
$P exec rm -rf /.old &
service -U $target
-# Spawn gettys for tty[23456]
-getty-start:VEPservice -u: hostname-start utmp-start
+# Hardware keys
+hwkeys-start:VEPservice -u: mounts-start
+ $P /root/bin/touchpad.sh
+ $P exec hwkeys &
+ service -U $target
+hwkeys-stop_cmd=pkill hwkeys
+
+# Spawn gettyd for tty[23456]
+gettyd-start:VEPservice -u: hostname-start utmp-start
+ $P exec gettyd tty2 tty3 tty4 tty5 tty6 &
+ service -U $target
+gettyd-stop_cmd=fuser -k /dev/tty2 /dev/tty3 /dev/tty4 /dev/tty5 /dev/tty6
+
+# Spawn agettys for tty[23456]
+agetty-start:VEPservice -u: hostname-start utmp-start
$P respawn setsid agetty 38400 tty2 linux
$P respawn setsid agetty 38400 tty3 linux
$P respawn setsid agetty 38400 tty4 linux
$P respawn setsid agetty 38400 tty5 linux
$P respawn setsid agetty 38400 tty6 linux
service -U $target
-getty-stop_cmd=fuser -k /dev/tty2 /dev/tty3 /dev/tty4 /dev/tty5 /dev/tty6
+agetty-stop_cmd=fuser -k /dev/tty2 /dev/tty3 /dev/tty4 /dev/tty5 /dev/tty6
# Spawn qingys for tty[7]
-qingy-start:VEPservice -u: hostname-start utmp-start modules-start
- $P respawn setsid /sbin/qingy-DirectFB tty7 &
+qingy-start:VEPservice -u: hostname-start utmp-start modules-start $devnodes-start
+ $P /root/bin/touchpad.sh
+ $P exec setsid /sbin/qingy tty7 &
$P chvt 7
service -U $target
qingy-stop_cmd=fuser -k /dev/tty7
+# Spawn xorg on tty[7]
+xinit-start:VEPservice -u: mounts-start
+ $P /root/bin/gpu $graphics | tee /root/gpu.log
+ $P /root/bin/touchpad.sh
+ $p chown andy:tty /dev/tty7
+ $p rm -f /usr/libexec/xf86-video-intel-backlight-helper
+ $p exec su -l andy -c /home/andy/bin/xsession &
+ service -U $target
+xinit-stop_cmd=fuser -k /dev/tty7
+
# Login records
utmp-start:VPservice -u: fsclean-start
for (i in /var/run/utmp /var/log/wtmp) {
# CPU freq
cpufreq-start:VPservice -u: mounts-start
- $P cpufreq-set -g ondemand
+ $P cpupower frequency-set -g ondemand
service -U $target
# Localhost
# Set hostname
hostname-start_cmd=hostname
+# Power management
+power-start:VPservice -u: mounts-start
+ echo 1 | $P tee /sys/module/snd_hda_intel/parameters/power_save
+ echo min_power | $P tee /sys/class/scsi_host/*/link_power_management_policy
+ echo auto | $P tee /sys/bus/usb/devices/*/power/control
+ echo auto | $P tee /sys/bus/pci/devices/*/power/control
+ echo 1500 | $P tee /proc/sys/vm/dirty_writeback_centisecs
+ service -U $target
+
# Kernel parameters
sysctl-start:VPservice -u: mounts-start
$P sysctl -p
$P chmod a+w /sys/class/leds/smc::kbd_backlight/brightness
$P chmod a+w /sys/class/backlight/gmux_backlight/brightness
+ $P chmod a+w /sys/devices/platform/applesmc.768/fan[12]_manual
+ $P chmod a+w /sys/devices/platform/applesmc.768/fan[12]_output
service -U $target
# System
# -------
-at-start_cmd=atd
+at-start:VPservice -u: fsclean-start
+ $P atd
+ service -U $target
at-stop_cmd=pkill atd
cron-start:VPservice -u: localhost-start fsclean-start
- $P cron
+ $P crond
service -U $target
cron-stop_cmd=pkill cron
hwclock-start_cmd=hwclock --hctosys --utc
hwclock-stop_cmd=hwclock --systohc --utc
+mdadm-start_cmd=mdadm --monitor --scan --daemonize
+mdadm-stop_cmd=pkill mdadm
+
+smartd-start_cmd=smartd
+smartd-stop_cmd=pkill smartd
+
sshd-start_cmd=/usr/sbin/sshd
sshd-stop_cmd=pkill sshd
# Desktop
# -------
-alsa-start_cmd=alsactl restore
+alsa-start:VPservice -u: boot
+ $P modprobe snd-hda-intel
+ $P modprobe snd-usb-audio
+ $P sleep 0.1
+ $P alsactl restore
+ service -U $target
alsa-stop_cmd=alsactl store
+bluez-start:VPservice -u: dbus-start
+ $P modprobe btusb
+ $P modprobe hidp
+ $P hciconfig hci0 up
+ $P exec /usr/libexec/bluetooth/bluetoothd &
+ service -U $target
+bluez-stop_cmd=pkill bluetoothd
+
cups-start_cmd=cupsd
cups-stop_cmd=pkill cupsd
# ------
apache2-start:VPservice -u: fsclean-start
$P install -o apache -g apache -d /var/run/session
- $P apache2 $apache2-opts
+ $P install -o apache -g apache -d /run/apache_ssl_mutex
+ $P apache2 $(apache2-opts)
+ service -U $target
apache2-stop_cmd=pkill apache2
-#bitlbee-start_cmd=sudo -u bitlbee bitlbeed /usr/sbin/bitlbee
bitlbee-start_cmd=bitlbee -D -u bitlbee
bitlbee-stop_cmd=pkill bitlbee
+cups-start_cmd=cupsd
+cups-stop_cmd=pkill cupsd
+
denyhosts-start_cmd=denyhosts.py --daemon
denyhosts-stop_cmd=pkill denyhosts.py
service -U $target
diod-stop_cmd=pkill diod
+docker-start_cmd=docker
+docker-stop_cmd=pkill docker
+
dovecot-start_cmd=dovecot
dovecot-stop_cmd=pkill dovecot
-eth0-start_cmd=dhcpcd eth0
+eth0-start_cmd=dhcpcd eth0 -4 -A
eth0-stop_cmd=dhcpcd eth0 -k
exim-start_cmd=exim -bd -q5m
exim-stop_cmd=pkill exim
-gitd-start:VPservice -u: boot
- $P exec /usr/libexec/git-core/git-daemon \
- '--syslog' \
- '--export-all' \
- '--user-path=git' \
- '--interpolated-path=/etc/git/%H%D' \
- '--listen=0.0.0.0' \
- '--user=nobody' \
- '--group=nobody' &
+fail2ban-start:VPservice -u: boot
+ $P mkdir -p /run/fail2ban
+ $P fail2ban-client start
service -U $target
+fail2ban-stop_cmd=fail2ban-client stop
+
+gitd-start_cmd=git daemon \
+ '--detach' \
+ '--syslog' \
+ '--export-all' \
+ '--user-path=git' \
+ '--interpolated-path=/etc/git/%H%D' \
+ '--listen=0.0.0.0' \
+ '--user=nobody' \
+ '--group=nobody'
gitd-stop_cmd=pkill git-daemon
+iptables-start:VPservice -u: boot
+ $P iptables-restore < /var/lib/iptables/rules-save
+ service -U $target
+iptables-stop:EVPservice -d:
+ $P iptables-save > /var/lib/iptables/rules-save
+ service -D $target
+
+jabberd-start_cmd=sudo -u jabber -g jabber jabberd-andy -b
+jabberd-stop_cmd=pkill --uid jabber
+
mailman-start_cmd=sudo -u mailman -g mailman \
/usr/lib64/mailman/bin/mailmanctl -s start
mailman-stop_cmd=sudo -u mailman -g mailman \
/usr/lib64/mailman/bin/mailmanctl stop
+minidlna-start:VPservice -u: mounts-start
+ $P install -o minidlna -g minidlna -d /var/run/minidlna
+ $P install -o minidlna -g minidlna -d /var/cache/minidlna
+ $P sudo -u minidlna -g minidlna minidlnad
+ service -U $target
+minidlna-stop_cmd=pkill minidlnad
+
munged-start:VPservice -u: localhost-start mounts-start
$P install -o munge -g munge -d /var/run/munge
$P sudo -u munge -g munge munged
privoxy-start_cmd=privoxy --user privoxy.privoxy /etc/privoxy/config
privoxy-stop_cmd=pkill privoxy
-rngd-start_cmd=rngd -b -s64 -t60
+rngd-start_cmd=rngd -b -s64 -W2048
rngd-stop_cmd=pkill rngd
+sasl-start_cmd=saslauthd -n0 -ashadow
+sasl-stop_cmd=pkill saslauthd
+
spamd-start_cmd=spamd -u spamd -d
spamd-stop_cmd=pkill spamd
service -U $target
tor-stop_cmd=pkill tor
+unifi-start:VPservice -u: wpa-start
+ cd /usr/lib/unifi
+ exec java -jar lib/ace.jar start &
+unifi-stop:EVPservice -d:
+ cd /usr/lib/unifi
+ java -jar lib/ace.jar stop
+ service -D $target
+
+ventrilo-opts=-f/opt/ventrilo-server/ventrilo_srv -d
+ventrilo-start_cmd=sudo -u ventrilo -g ventrilo /opt/ventrilo-server/ventrilo_srv
+ventrilo-stop_cmd=pkill -u ventrilo
+
+vpn-start:VPservice -u: localhost-start
+ $P ipsec start
+ $P exec /usr/sbin/rp-l2tpd &
+ $P exec /usr/sbin/pptpd &
+ service -U $target
+vpn-stop:VQPservice -d: /
+ $P pkill rp-l2tpd
+ $P pkill pptpd
+ $P ipsec stop
+ service -D $target
+
wlan0-start:VPservice -u: wpa-start
- $P dhcpcd wlan0
+ $P dhcpcd -4 wlan0
service -U $target
wlan0-stop_cmd=dhcpcd wlan0 -k
-wpa-start:VPservice -u: mdev-start
- $P modprobe b43
- $P exec wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &
+wpa-start:VPservice -u: $devnodes-start
+ $P modprobe brcmfmac && sleep 1
+ $P exec wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf &
service -U $target
wpa-stop_cmd=pkill wpa
-# Library
+# Library
# -------
%-start:QVPservice -u: boot
if (~ $#($stem^-start_cmd) 0)