#!/bin/sh
# disable kernel messages
if [ -f /proc/sys/kernel/printk ];then
	echo 0 > /proc/sys/kernel/printk
fi
ln -s /proc/self/fd/2 /dev/stderr
echo "System initialization ..."
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
: ${rcquiet=0}
if test x"$rcquiet" = x"0" && sh -n /etc/rc.conf >/dev/null 2>&1; then
	. /etc/rc.conf
	unset rcquiet
	rcquiet=0
else
	unset rcquiet
	rcquiet=1
fi
{
	grep '^#INIT ' /etc/init.d/* | \
	    sort -nk2 | \
	    while read line; do
		rcenabled=NO
		rcname=${line%%:*}
		rcname=${rcname##*/}
		test x"$rcquiet" = x"0" && eval 'rcenabled=${'"${rcname}"':-NO}'
		test x"$rcenabled" = x"NO" || echo -n "Starting ${rcname}... "
		sh ${line%%:*} autostart
		rc=$?
		case $rcenabled:$rc in
		(NO:*)
			;;
		(*:0)
			echo done.
			;;
		(*:*)
			echo "failed ($rc)."
			;;
		esac
	    done
} |tee /dev/stderr |logger -p 6 -t ''
