#!/bin/sh
#
# frad		Bring up/down the frame relay devices
#
# chkconfig: 345 08 98
# description: Configures the hardware and software in preparation for the \
#              networking scripts to configure the interfaces at boot time.

# Please note:
#
# The SDLA/DLCI configuration system is not really set up to be taken up and
# down as this would suggest.  The SDLA can only be initialized once, as part
# of it's boot process.  Both the programs will exit with errors, so this does
# work, but something more elegant would be a good thing.

# Source function library.
. /etc/rc.d/init.d/functions

# Check for network startup
. /etc/sysconfig/network
[ ${NETWORKING} = "no" ] && exit 0

# We need the config file
[ -f /etc/frad.conf ] || exit 0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting frad: "

	/sbin/fradcfg -Q /etc/frad.conf
	/sbin/dlcicfg -Q file /etc/frad.conf

	/sbin/ifconfig sdla0 up

	echo "frad"
        touch /var/lock/subsys/frad
        ;;
  stop)
	echo -n "Stopping frad: "

	/sbin/ifconfig sdla0 down

	echo "frad"
        rm -f /var/lock/subsys/frad
        ;;
  *)
        echo "Usage: frad {start|stop}"
        exit 1
esac

exit 0
