#!/bin/sh
#
# pppoed	This shell script takes care of starting and stopping
#              	the pppoed.
#
# chkconfig: - 12 84
# description: pppoed

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# See how we were called.
case "$1" in
  start)
	ret=0
        echo -n "Starting pppoed: "

	/sbin/modprobe mssclampfw
	/sbin/modprobe pppox
	/sbin/ifconfig eth0 up
        /usr/sbin/pppoed -I eth0 -R -1
	ret=$?
        touch /var/lock/subsys/pppoed
	if [ "$BOOTUP" = "color" ]; then
		[ "${ret}" -eq 0 ] && echo_success || echo_failure
	fi
	echo
	exit ${ret}
        ;;
  stop)
	ret=0
        # Stop daemons.
        echo -n "Shutting down pppoed: "
       	killproc pppoed
        rm -f /var/lock/subsys/pppoed
       	killproc pppd
        rm -f /var/lock/subsys/pppd
        /sbin/rmmod mssclampfw
        /sbin/rmmod pppox
	if [ "$BOOTUP" = "color" ]; then
		[ "${ret}" -eq 0 ] && echo_success || echo_failure
	fi
	echo
	exit ${ret}
        ;;
  status)
	status pppoed
	exit $?
	;;
  restart)
	$0 stop
	$0 start
	exit $?
	;;
  *)
        echo "Usage: pppoed {start|stop|status|restart}"
        exit 1
esac

exit 0
