#!/bin/sh
#
# Copyright (c) FUJITSU LIMITED 1995,1996
# All Rights Reserved
#
# $Id: PFUagaconfig.sh,v 1.7 1996/03/25 03:23:42 mkatoh Exp $
#
# Copyright (c) 1991 by Sun Microsystems, Inc.

# startup script for AG-10 Graphics Accelerator

FBNAME=PFUaga
DRVNAME=PFUaga
BOARDNAME=PFU,aga
INSTDIR=/usr
CONFIG=${INSTDIR}/sbin/ag10config

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

# If you want to use an alternative monitor type rather than the default,
# uncomment the appropriate line to specify a monitor type.
# See manual pages.

#montype=1280_76
#montype=1280_67
#montype=1152_76
#montype=1152_66
#montype=1024_76

case "$1" in
'start')
	aga_count=`prtconf | grep -c ${BOARDNAME}`
	if [ ${aga_count} -eq 0 ]; then
		exit 0
	fi

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

	fbdevs=`/bin/ls $devpath/* 2> /dev/null | egrep "/${FBNAME}[0-9]"`

	if [ "$fbdevs" = "" ]; then
		exit 0
	fi

	case `uname -r` in
	# 5.4 or later expected
	5.4)
		drvpath=/kernel/drv;;
	5.[5-9])	
		plat=`uname -i`
		if [ "$plat" = "" ]; then
			plat=sun4m
		fi
		drvpath=/platform/$plat/kernel/drv;;
	esac
		
	err=`modload $drvpath/${DRVNAME} 2>&1`
	if [ $? -ne 0 ]; then
		echo "Problems loading AG-10 driver: $err"
		exit 1
	fi

	if [ -x ${CONFIG} ]; then
		montype=${montype:-default}
		for fbdev in $fbdevs
		do
			${CONFIG} -d $fbdev -I ${INSTDIR}/lib -m $montype
		done
	fi
	;;
*)
	echo "Usage: $0 start"
	;;
esac

exit 0
