#	START NEW ARIX SCCS HEADER
#
#	@(#) acdbsetup: version 25.1 created on 12/2/91 at 15:47:15
#
#	Copyright (c) 1990 by Arix Corporation
#	All Rights Reserved
#
#	ident	"@(#)acdbsetup	25.1	12/2/91 Copyright (c) 1990 by Arix Corporation"
#
#	END NEW ARIX SCCS HEADER
#

ACDBSLOTS=`css | grep IOPM.ACDB | sed -e 's/^ *\([\.0-9]\{1,5\}\).*$/\1/'`

if [ "$ACDBSLOTS" = "" ]
then
	exit 0
fi

set $ACDBSLOTS

ACDBNUMBER=0
while [ $1 ]
do
	if [ $ACDBNUMBER -gt 4 ]
	then
		echo More than 5 IOPM/ACDBs found.
		echo Only the first 5 are loaded.
	fi

	if [ ! -f /iopm/cf/iopm$1 ]
	then
		echo Create the load script for IOPM in slot $1
		/bin/cp /iopm/cf/load.acdb /tmp/iopm$1
		/bin/sed -e "/^ACDBNUM=0/s/0/$ACDBNUMBER/" /tmp/iopm$1 > /iopm/cf/iopm$1
		/bin/rm /tmp/iopm$1
		chmod 755 /iopm/cf/iopm$1
		echo Now let\'s make tty nodes for IOPM/ACDB in slot $1
		/local/bin/mktty I $ACDBNUMBER
		(cd /iopm/cf; ./iopm$1)
	else
		echo A load script already exist for the IOPM in slot $1.
		echo It will not be overwritten, nor will new tty nodes be made.
	fi

	ACDBNUMBER=`expr $ACDBNUMBER + 1`
	shift
done

