#!/bin/sh
#ident	"@(#)leoconfig.sh	4.1	94/09/29 SMI"
#
# Copyright (c) 1991 by Sun Microsystems, Inc.
#
# /etc/rc2.d/S91leoconfig - Configure for the Leo.

PATH=/usr/bin:/bin:/usr/sbin

#
#  Uncomment the appropriate line to specify a monitor.
#

MONTYPE="-m default"		# Probe the monitor for its type
# MONTYPE="-m 1024_60"          # 1024x768 @60Hz.
# MONTYPE="-m 1024_76"          # 1024x768 @76Hz.
# MONTYPE="-m 1152_66"          # 1152x900 @66Hz.
# MONTYPE="-m 1152_76"          # 1152x900 @76Hz.
# MONTYPE="-m 1280_67"          # 1280x1024 @67Hz.
# MONTYPE="-m 1280_76"          # 1280x1024 @76Hz.
# MONTYPE="-m stereo_108"       # 960x640 stereo @108Hz.
# MONTYPE="-m stereo_114"       # 960x640 stereo @114Hz.
# MONTYPE="-m ntsc"		#
# MONTYPE="-m pal"		#

devpath=/dev
test -d /dev/fbs && devpath=/dev/fbs

# 
# Check the $devpath directory for any leos
#
devs=`/bin/ls $devpath | grep leo`

#
# If there aren't any around, there's no need to load
# the driver, so quit.
#
if [ "$devs" = "" ]
then
        exit 0
fi

#
# We have a leo, so modload the driver and
# make sure that it was successful.
#
err=`modload /kernel/drv/leo 2>&1`
if [ $? -ne 0 ]
then
        echo "Problems loading Leo driver: $err"
        exit 1
fi

#
# Now download the microcode to each leo.
#
for inst in $devs
do
	#
	# If we can find the binary, then download the microcode to
	# this instance.
	#
	if [ -f /usr/sbin/leoconfig ]
	then
		errmsg="`/usr/sbin/leoconfig ${MONTYPE} -d $devpath/$inst -I /usr/lib 2>&1`"
		test -n "$errmsg" && echo "$errmsg"
	fi
done

#echo Leoconfig terminating normally.
exit 0
