#!/sbin/sh
#
# ether		Initialize ethernet card. This does not do anything
#		yet; eventually we use this script to call
#		/sbin/ifconfig to set up the IRQ, IO port etc.
#
# Version:	@(#) /sbin/init.d/ether 1.01 26-Oct-1993
#
# Author:	Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

  # Source function library.
  . /sbin/init.d/functions

  # Get network configuration.
  # IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the 
  # eth0 interface. If you're only using loopback or SLIP, don't include the
  # rest of the lines in this file.

  # Edit for your setup.
  HOSTNAME="`hostname`"		# REPLACE with YOUR IP address!
  IPADDR="129.69.47.53"		# REPLACE with YOUR IP address!
  NETMASK="255.255.255.0"	# REPLACE with YOUR netmask!
  NETWORK="129.69.47.0"		# REPLACE with YOUR network address!
  BROADCAST="129.69.47.255"	# REPLACE with YOUR broadcast address or blank
  GATEWAY="129.69.47.36"	# REPLACE with YOUR gateway address!

  # See how we were called.
  case "$1" in
    start)
	# Initialize ethernet card.
        if [ "`cat /etc/NETWORKING 2>/dev/null`" = YES ]
        then
            # First, set up the ethernet card.
	    echo -n "Initializing ethernet card... "
	    ifconfig eth0 ${HOSTNAME} broadcast ${BROADCAST} netmask ${NETMASK}

	    # Now add any needed routes.
	    echo -n "routing... "
	    route add -net ${NETWORK} dev eth0
	    route add default         gw ${GATEWAY}   metric 1 dev eth0

	    echo "done."
	else
	    # Fake a primary interface.
	    ifconfig lo $HOSTNAME
	    route add -host $HOSTNAME dev lo
	fi
	;;
    stop)
	# Shut down ethernet card (runlevel 1)
	echo "Shutting down ethernet card"
	ifconfig eth0 down
	;;
    *)
	# Oops someone made a typo.
	echo "Usage: /sbin/init.d/ether {start|stop}"
	exit 1
  esac

exit 0
