#!/bin/bash
#
# /etc/rc.single - single-user startup script
#

# Load configuration
if [ -f /etc/rc.d/rc.conf ]; then
  . /etc/rc.d/rc.conf
fi

if [ "$PREVLEVEL" = "2" ]; then
	for service in $SERVICES; do
		/usr/sbin/sstop $service
	done
fi

if [ "$PREVLEVEL" != "N" ]; then
	# Terminate all processes
	/sbin/killall5 -15
	/usr/bin/sleep 5
	/sbin/killall5 -9

	# Start udev
	mount -n -t proc proc /proc
	mount -n -t sysfs sysfs /sys
	/sbin/start_udev

	# Start log daemons
	/usr/sbin/syslogd
	/usr/sbin/klogd -c 4
fi

if [ "$RUNLEVEL" = "1" ]; then
	# Enter single-user mode
	exec /sbin/init -t1 S
fi

# EOF
