#!/bin/sh
#
# MIT Sun4 RC script. Installation assumes this file does not change.
# Customize behavior in rc.conf.
#
# Tom Coppeto
# MIT Network Services
# 6/27/91
#
# Last Modified 5 January 1996 by jyp
# $Author: testuser $
#


echo ""
echo  "MIT network configuration: " > /dev/console

. /etc/athena/rc.conf


if [ "${TIMECLIENT}" = "true" ]; then
		if [ -f /etc/athena/gettime ]; then
			echo -n "setting time: "                 > /dev/console
                	/etc/athena/gettime -s ${TIMEHUB}        > /dev/console
		fi
fi

if [ "${AFSCLIENT}" = "true" ]; then
	echo  -n "AFS... "                                       > /dev/console
	if [ -d /usr/vice/etc/modload ]; then
        	echo -n 'kernel loader.. '                       > /dev/console
       		cd /usr/vice/etc/modload
        	if [ -f libafs.o ]; then
                	echo -n "loading AFS.. "                 > /dev/console
                	/usr/etc/modload ./libafs.o            > /dev/null 2>&1
                	if [ $? != 0 ]; then
                   		echo  "** error loading AFS. "   > /dev/console
                	fi
        	else
                	echo " **no kernel library object."      > /dev/console
        	fi
        	cd /
	fi

	if [ -f /etc/athena/afsd ]; then
        	echo 'afsd.. '                                   > /dev/console
        	/etc/athena/afsd				 > /dev/console
	fi
	echo -n "configuring afs.. "
	/etc/athena/config_afs
	sync
	if [ -f /bin/athena/detach ]; then
		/bin/athena/detach -a
		cp /dev/null /usr/tmp/attachtab
	fi
        echo ""                                                  > /dev/console
fi


if [ "${SNMP}" = "true" ]; then
        if [ -f /etc/snmpd ]; then
                echo -n "snmpd.. "                               > /dev/console                
		/etc/snmpd
        fi
fi

if [ "${ZCLIENT}" = "true" ]; then
	if [ -f /etc/athena/zhm ]; then
		echo -n "zhm.. "                                 > /dev/console
		/etc/athena/zhm 
	fi
fi

if [ "${SYSPACK}" != "" ]; then
	echo -n "attaching system pack..."                       > /dev/console
	/bin/athena/attach -f ${SYSPACK}
fi

        
if [ "${MAILSERVER}" = "true" ]; then
	echo "sendmail..."                                       > /dev/console
	rm -f /usr/spool/mqueue/x*
	rm -f /usr/spool/mqueue/t*
	rm -f /usr/spool/mqueue/l*
	/usr/lib/sendmail -bd -q30m
fi

if [ -x /etc/athena/rc.local ]; then
	echo "/etc/athena/rc.local..."				 > /dev/console
	/etc/athena/rc.local
fi


if [ "${NOTIFYUPDATE}" = "true" -o "${AUTOUPDATE}" = "true" ]; then
	echo "checking for updates..."                           > /dev/console
	if [ -x /usr/athena/etc/update_check ]; then
		/etc/athena/update_check 
	elif [ -x /etc/athena/update_check ]; then
		/etc/athena/update_checkn
	fi    
fi


echo "done!"                                                     > /dev/console

exit 0

















