:
#    Portions Copyright 1983-1989 The Santa Cruz Operation, Inc
#	  All Rights Reserved
#	Copyright (c) 1984, 1986, 1987, 1988 AT&T
#	  All Rights Reserved

#	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
#	The copyright notice above does not evidence any
#	actual or intended publication of such source code.


#	"Run Commands" executed when the system is changing to init state 2,
#	traditionally called "multi-user".

# Begin SCO_BASE
PATH=/etc:/bin:/usr/bin
export PATH
HZ=60
export HZ
exec < /dev/console > /dev/console 2>&1		# input and output from console
bootlog=/etc/bootlog

# if autoboot is on
[ "$1" = -a ] && {
	AUTOFLAG=-a
	AUTOBOOT="| tee -a $bootlog"	
	BOOTLOG=$bootlog
	export AUTOFLAG AUTOBOOT BOOTLOG

	echo "System autoboot at `date`" >> $BOOTLOG
}

# End SCO_BASE


grep VERBOSE=NO /etc/default/boot > /dev/null 2>&1
if [ $? = 0 ]
then
	rclog=/etc/rclog
else
	rclog=/dev/console
fi


set `who -r`
if [ "$9" = "S" ]
then
	echo 'The system is coming up.  Please wait.'  >> $rclog 2>&1
	BOOT=yes

elif [ "$7" = "2" ]
then
	echo 'Changing to state 2.'  >> $rclog 2>&1
	if [ -d /etc/rc2.d ]
	then
		for f in /etc/rc2.d/K*
		{
			if [ -s ${f} ]
			then
				/bin/sh ${f} stop  >> $rclog 2>&1
			fi
		}
	fi
fi

if [ -d /etc/rc2.d ]
then
	for f in /etc/rc2.d/S*
	{
		if [ -s ${f} ]
		then
			if [ "$f" = "/etc/rc2.d/S00MOUNTFSYS" ]
			then
				/bin/sh ${f} start 
			else
				/bin/sh ${f} start >> $rclog 2>&1
			fi
		fi
	}
fi

# PC 6300+ Style Installation - execute rc scripts from driver packages
if [ -d /etc/idrc.d ]
then
	for f in /etc/idrc.d/*
	{
		if [ -s ${f} ]
		then
			/bin/sh ${f}  >> $rclog 2>&1
		fi
	}
fi
if [ "${BOOT}" = "yes" -a -d /etc/rc.d ]
then
	for f in `ls /etc/rc.d`
	{
		if [ ! -d /etc/rc.d/$f -a "$f" != "README" -a ! -s /etc/init.d/${f} ]
		then
			/bin/sh /etc/rc.d/${f}  >> $rclog 2>&1
		fi
	}
fi

# Begin SCO_BASE
# run /etc/rc script for Xenix compatibility
if [ "${BOOT}" = "yes" -a -s /etc/rc ]
then
	/bin/sh /etc/rc  >>  $rclog 2>&1
fi
# End SCO_BASE

if [ "${BOOT}" = "yes" -a "$7" = "2" ]
then
	echo 'The system is ready.'  >> $rclog 2>&1
elif [ "$7" = "2" ]
then
	echo 'Change to state 2 has been completed.' >> $rclog 2>&1
fi

