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
/sbin/sulogin
......@@ -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
fi
if [ -d ./log ] && [ ! -L ./log/supervise ]; then
rm -rfv ./log/supervise
ln -Ts "$tmpstate"/log."${PWD##*/}" ./log/supervise
fi
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
tmpify
popd > /dev/null
tmpify "$sv"
done
# Do the same for shutdown control files.
......
#!/bin/sh
#!/bin/sh -eu
PATH=/bin:/usr/bin
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.
</longdescription>
<maintainer type="person">
<email>flussence@gmail.com</email>
......@@ -14,6 +16,8 @@
<doc>http://smarden.org/runit/</doc>
</upstream>
<use>
<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
</flag>
</use>
</pkgmetadata>
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