summary refs log tree commit diff
path: root/3
diff options
context:
space:
mode:
authorJuan RP <xtraeme@gmail.com>2014-08-07 17:22:57 +0200
committerJuan RP <xtraeme@gmail.com>2014-08-07 17:22:57 +0200
commit53a09fa9d57bad1b074d0f72a302ffc4517d4b0f (patch)
tree0fbaaa59a8e1eb3669bb4ad6bd7925aa493f5253 /3
parent18ae61d8157af26fb58041bdfcf8cc405f1a2157 (diff)
downloadrunit-void-53a09fa9d57bad1b074d0f72a302ffc4517d4b0f.tar.gz
runit-void-53a09fa9d57bad1b074d0f72a302ffc4517d4b0f.tar.xz
runit-void-53a09fa9d57bad1b074d0f72a302ffc4517d4b0f.zip
Added "core" services that are run from scripts on stage 1.
- /etc/runit/functions: contains common functions to be used in core-services.
- /etc/runit/core-services: directory containing one-time tasks run in stage 1.
- Added LXC container detection to disable some core services.

This accidentally also fixes the issue of unicode not working in the active
TTY from stage 1.
Diffstat (limited to '3')
-rwxr-xr-x330
1 files changed, 19 insertions, 11 deletions
diff --git a/3 b/3
index 577568d..05fae3c 100755
--- a/3
+++ b/3
@@ -3,43 +3,51 @@
 
 PATH=/usr/bin:/usr/sbin
 
-. /etc/rc.conf
+. /etc/runit/functions
+detect_virt
+[ -r /etc/rc.conf ] && . /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..."
+echo
+msg "Waiting for services to stop...\n"
 sv -w196 force-stop /var/service/*
 sv exit /var/service/*
 
 stty onlcr
 
-echo "Saving random seed..."
+msg "Saving random seed...\n"
 dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 >/dev/null 2>&1
 
-if [ -n "$HARDWARECLOCK" ]; then
+if [ -z "$VIRTUALIZATION" -a -n "$HARDWARECLOCK" ]; then
     hwclock --systohc ${HARDWARECLOCK:+--$(echo $HARDWARECLOCK |tr A-Z a-z)}
 fi
 
 halt -w  # for utmp
 
-echo "Stopping udev..."
-udevadm control --exit
+if [ -z "$VIRTUALIZATION" ]; then
+    msg "Stopping udev...\n"
+    udevadm control --exit
+fi
 
-echo "Sending TERM signal to processes..."
+msg "Sending TERM signal to processes...\n"
 pkill --inverse -s0,1 -TERM
 sleep 5
-echo "Sending KILL signal to processes..."
+msg "Sending KILL signal to processes...\n"
 pkill --inverse -s0,1 -KILL
 
-echo "Unmounting filesystems, disabling swap..."
+msg "Unmounting filesystems, disabling swap...\n"
 umount /tmp
 swapoff -a
 umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
 
-echo "Remounting rootfs read-only..."
-mount -o remount,ro /
+if [ -z "$VIRTUALIZATION" ]; then
+    msg "Remounting rootfs read-only...\n"
+    mount -o remount,ro /
+fi
+
 sleep 1
 sync