#!/bin/sh
#	Athena boot startup script for use with Linux
#	Borrowed some from Ultrix script
#	Borrowed some more from Solaris script
#
#	$Id: rc.athena,v 1.7 1997/12/19 18:54:47 svalente Exp $

echo "MIT configuration..."

# Read configuration variables
. /etc/athena/rc.conf

# Make sure time is set properly for kerberos and such
# XXX: If this fails (e.g., we don't have a network), then what?  -warlord
if [ "${TIMECLIENT}" = "true" ]; then
	echo -n "Setting time via network: "
	if [ -x /etc/athena/gettime ]; then
		/etc/athena/gettime -s ${TIMEHUB}
	else
		echo "can't find gettime!"
	fi
fi

# Load up AFS
if [ "${AFSCLIENT}" = "true" ]; then
	# Variable inherited from athena.init.
	if [ ! -z "$CacheClean" ]; then
		if [ ! -f "$CacheClean" ]; then
			echo "Clearing the AFS cache."
			rm -f $CacheItems
		fi
		rm -f $CacheClean
	fi
	if [ -r /etc/rc.d/rc.afs ]; then
		echo "Starting AFS client: "
		. /etc/rc.d/rc.afs
	fi
fi

#
# Now start standard clients
#

# Inetd
if [ -x /etc/athena/inetd ]; then
	echo "Loading Athena Internet Daemon..."
	/etc/athena/inetd
fi

# Zephyr Host Manager
if [ "${ZCLIENT}" = "true" ]; then
	if [ -x /etc/athena/zhm ]; then
		echo "Loading Zephyr Host Manager..."
		/etc/athena/zhm
	fi
fi

echo -n "Fixing noattach, nocreate, noremote, nologin... "
if [ "${NOCREATE}" = "true" ]; then
        echo -n "" >> /etc/nocreate
else
        rm -f /etc/nocreate
fi
if [ "${NOATTACH}" = "true" ]; then
        echo -n "" >> /etc/noattach
else
        rm -f /etc/noattach
fi
if [ "${NOREMOTE}" = "true" ]; then
        echo -n "" >> /etc/noremote
else
        rm -f /etc/noremote
fi

echo "done."

# Run Reactivate
if [ -x /etc/athena/reactivate ]; then
	/etc/athena/reactivate
fi

rm -f /etc/nologin
echo "Logins now possible."

echo "Athena configuration complete."
