#!/bin/sh

#ident	"@(#) $Id: ethertrunkinit,v 1.4 1998/11/19 21:05:17 akolb Exp $"

#
#	STREAMware TCP
#	Copyright 1998 AMD, Inc. All Rights Reserved.
#	All Rights Reserved.
#

umask 022

#	Configuration of Fast EtherChannel trunks.

LOG=/tmp/trunk.start
PermLog=/var/adm/log/inet.start
export LOG PermLog
exitcode=0

DATADIR=/etc/etherchannel
TRUNKCONF=${DATADIR}/ethertrunk.conf
TRUNKBUILD=${DATADIR}/parsetrunk
TEMPFILE=${DATADIR}/tmp_file
TEE=/bin/tee
LOG=/tmp/trunk.start

export DATADIR TRUNKCONF TRUNKBUILD

case "$1" in
start)
	#
	#  Create etherchannels
	#
	if [ -f $TRUNKCONF -a -x $TRUNKBUILD ]
	then
		echo "Fast EtherChannel Configuration from $TRUNKCONF"
		$TRUNKBUILD $TRUNKCONF > $TEMPFILE
		if [ $? != 0 ]
		then
		    echo "Check syntax of configuration file $TRUNKCONF" | $TEE $LOG
		else
		    /bin/sh $TEMPFILE
		fi
		/bin/rm $TEMPFILE
	fi
	;;
stop)
	# Nothing to do.
        ;;
esac
