#!/bin/sh
#
# set up network devices
#

#locate and source functions script
source `PATH=$INIT_D/:/sbin/init.d:/etc/init.d:/etc/rc.d type -p functions`

#sysconfig contains network parameters
source $sysconfig_nicconfig

case "$1" in
  start)
     i=0
     while [ -n "${NET_DEVICE[$i]}" ]
     do
       if [ "${NET_ONBOOT[$i]}" = yes ]
       then
          echo "Bringing up the ${NET_DEVICE[$i]} interface..."
          ifconfig "${NET_DEVICE[$i]}" ${NET_IP[$i]} \
          	broadcast ${NET_BROADCAST[$i]} netmask ${NET_MASK[$i]}
          up_evaluate_retval
       fi
       i=$(($i+1))
     done
     ;;

  stop)
     i=0
     while [ -n "${NET_DEVICE[$i]}" ]
     do
       if [ "${NET_ONBOOT[$i]}" = yes ]
       then
          echo "Bringing down the ${NET_DEVICE[$i]} interface..."
          ifconfig "${NET_DEVICE[$i]}" down
          up_evaluate_retval
       fi
       i=$(($i+1))
     done
     ;;
  *)
     exit 1
     ;;
esac

exit 0
