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

source ${INIT_D:-/sbin/init.d}/functions

#/etc/sysconfig contains network parameters
source_sysconfig

case "$1" in
  start)
     i=0
     while [ "z${NET_DEVICE[$i]:-}" != "z" ]
     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]}
          evaluate_retval
       fi
       i=$(($i+1))
     done
     ;;

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

exit 0
