#!/bin/sh
# system one time initialization tasks

PATH=/sbin:/usr/sbin:/bin:/usr/bin

if [ -f /etc/runit/native.boot.run ] || [ -n "$bootrun" ]; then
	bootrun=1
fi

if [ -d /etc/runit/boot-run ] && [ ! -z $bootrun ]; then
	for f in /etc/runit/boot-run/*.sh; do
		[ -r "$f" ] && . "$f"
	done
else
	/lib/runit/run_sysv_scripts '/etc/rcS.d'
fi

# Now /run is mounted.
install -m000 /dev/null /run/runit.stopit
install -m000 /dev/null /run/runit.reboot

# That is it.  We do as little, as possible at stage1. Services, that do
# not have runscripts and invoked via init.d scripts are started at
# stage2. This way, daemon that hangs or otherwise misbehave do not
# block whole boot process.
#
# Thanks to Lorenz for suggestion.
