Verified Commit 73f72941 by flussence

runit: minor improvements

- Simplify files/ctrlaltdel (just reboot, don't roleplay as sysvinit) - Run shellcheck on files/1 and fix bashisms (others already clean) - $sv/log/supervise directories now handled in tmpify()
parent a9c5105e
......@@ -12,7 +12,8 @@ RUNLEVEL=S /sbin/openrc sysinit
RUNLEVEL=S /sbin/openrc boot
# Spawn a login prompt if "single" is passed on the boot command line.
case " $(</proc/cmdline) " in
read -r kcmdline </proc/cmdline
case " $kcmdline " in
*" single "* )
/sbin/openrc single
......@@ -29,18 +30,26 @@ findmnt -nt tmpfs /run > /dev/null && install -m 0755 -d "$tmpstate"
tmpify() {
[ -L supervise ] && return
rm -rfv supervise
ln -Ts "$tmpstate"/"${PWD##*/}" supervise
cd "$1" || return
if [ ! -L ./supervise ]; then
rm -rfv ./supervise
ln -Ts "$tmpstate"/"${PWD##*/}" ./supervise
if [ -d ./log ] && [ ! -L ./log/supervise ]; then
rm -rfv ./log/supervise
ln -Ts "$tmpstate"/log."${PWD##*/}" ./log/supervise
cd "$OLDPWD" || return
# Attempt to symlink each $sv's supervise/ directory to /run/runit/$sv,
# in order to avoid disk writes in /etc. Existing directories are replaced,
# existing symlinks and log services are untouched.
for sv in /etc/service/*/; do
pushd "$sv" > /dev/null || break
popd > /dev/null
tmpify "$sv"
# Do the same for shutdown control files.
#!/bin/sh -eu
MSG="System is going down for reboot in 14 seconds..."
# /etc/runit/1 will make these dangling symlinks to /run/runit/*, so create them now.
# touch should be equally as safe as chmod here, which is required to reboot anyway.
cd /etc/runit
touch stopit reboot
chmod 100 stopit reboot \
&& echo "$MSG" | $(type -p wall || echo "busybox wall")
/bin/sleep 14
chmod 100 stopit reboot
......@@ -5,6 +5,8 @@
runit is a process supervision suite with a focus on being usable as a sysvinit replacement.
It provides similar functionality to other packages like <pkg>sys-apps/s6</pkg> and
<pkg>sys-process/daemontools</pkg>, and a compatibility/migration path for the latter.
As this package only provides an init and service manager, it still depends on
<pkg>sys-apps/openrc</pkg> for the rc layer inbetween.
<maintainer type="person">
......@@ -14,6 +16,8 @@
<flag name="symlink">Symlink /service to /etc/service to allow abbreviated `sv` commands</flag>
<flag name="symlink">
Create /service symlink to allow abbreviated `sv` commands without setting $SVDIR
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment