File: //etc/runit/2
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin
SVDIR=/etc/service
mkdir -p /run/runit/supervise
mkdir -p /run/runit/sv
if [ ! -z $runitdir ] && [ -d /etc/runit/runsvdir/"$runitdir" ]; then
runsv_dir="$runitdir"
elif [ -r /etc/runit/default.runsvdir ]; then
runsv_dir="$(cat /etc/runit/default.runsvdir)"
else
runsv_dir=default
fi
# This script is also invoked in runit-run package: we must start sulogin
# and sysv scripts only if `runit' is the current init system.
if [ -f /run/runit.stopit ] ; then
# single mode
if grep -q -w -i 'single' /proc/cmdline ; then
chpst -P /sbin/sulogin -p /dev/tty1
fi
runsvchdir "$runsv_dir" || runsvchdir default
# Give sysv scripts 90 seconds (hardcoded in async-timeout source) to
# start. If something goes wrong, they are detached from controlling
# terminal: in this case tty1 would likely look ugly -- output from sysv scripts
# is written over terminal session, but at least we would be able to login
# see #838480-msg#49
if [ "$runsv_dir" != solo ] && [ ! -e /etc/runit/no.emulate.sysv ]; then
/lib/runit/async-timeout /lib/runit/run_sysv_scripts '/etc/rc2.d'
fi
else
runsvchdir svmanaged
fi
exec env - PATH=$PATH \
runsvdir -P "${SVDIR}" 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'