diff options
author | Juan RP <xtraeme@gmail.com> | 2014-04-25 23:20:32 +0200 |
---|---|---|
committer | Juan RP <xtraeme@gmail.com> | 2014-04-25 23:20:32 +0200 |
commit | b2fec086b9f498102537e0ff936138b2960e4082 (patch) | |
tree | 13dd068d53033bf799a502fff1acbf46dfe0743c /3 | |
download | runit-void-b2fec086b9f498102537e0ff936138b2960e4082.tar.gz runit-void-b2fec086b9f498102537e0ff936138b2960e4082.tar.xz runit-void-b2fec086b9f498102537e0ff936138b2960e4082.zip |
Initial import of runit init scripts based on ignite.
I did not use ignite because it needs bash, and I don't really want it.
Diffstat (limited to '3')
-rwxr-xr-x | 3 | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/3 b/3 new file mode 100755 index 0000000..577568d --- /dev/null +++ b/3 @@ -0,0 +1,45 @@ +#!/bin/sh +# vim: set ts=4 sw=4 et: + +PATH=/usr/bin:/usr/sbin + +. /etc/rc.conf + +if [ -e /run/runit/reboot ]; then + touch /etc/runit/reboot + chmod 100 /etc/runit/reboot +fi + +echo "Waiting for services to stop..." +sv -w196 force-stop /var/service/* +sv exit /var/service/* + +stty onlcr + +echo "Saving random seed..." +dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 >/dev/null 2>&1 + +if [ -n "$HARDWARECLOCK" ]; then + hwclock --systohc ${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z)} +fi + +halt -w # for utmp + +echo "Stopping udev..." +udevadm control --exit + +echo "Sending TERM signal to processes..." +pkill --inverse -s0,1 -TERM +sleep 5 +echo "Sending KILL signal to processes..." +pkill --inverse -s0,1 -KILL + +echo "Unmounting filesystems, disabling swap..." +umount /tmp +swapoff -a +umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs + +echo "Remounting rootfs read-only..." +mount -o remount,ro / +sleep 1 +sync |