#----------------------------------------------------------------------------
# /etc/rc.d/rc120.net - loading driver for netword card
# was file /etc/rc.d/rc120.eth
#
# Creation:         29.03.2000  fm
# Last Update:  $Id: rc120.net 8520 2005-05-08 15:26:18Z rresch $
#----------------------------------------------------------------------------

begin_script NET "loading network drivers ..."

# Loading base drivers if available (otherwise they aren't needed)

do_insmod_if_exists kernel/lib crc32
do_insmod_if_exists kernel/drivers/net/tokenring tms380tr
do_insmod_if_exists kernel/drivers/net 8390
do_insmod_if_exists kernel/drivers/net pci-scan-db
do_insmod_if_exists kernel/drivers/net mii

[ "$NET_DRV_N" -eq 0 ] || for idx in `seq 1 $NET_DRV_N`
do
  eval drv='$NET_DRV_'$idx
  eval opt='$NET_DRV_'$idx'_OPTION'

  case $drv
  in
    cs89x0)
      do_insmod $drv $opt
      if [ $? != 0 ]
      then
        echo $SCRIPT" module cs89x0 failed, retrying with reset!" >>/bootmsg.txt
        flag=0
        opt1=

        for var in $opt
        do
          [ "$var" = "-o" ] && flag=1
          var1=`echo $var | sed '/io=/s/.$/1/' | sed '/io=/s/.,/1,/g'` 
          opt1=`echo $opt1 $var1` 
        done

        [ $flag = 1 ] && opt=`echo $opt1` || opt=`echo -o cs8920 $opt1`

        do_insmod cs89x0 $opt

        if [ $? != 0 ]
        then
          echo $SCRIPT" module cs89x0 failed!" >>/bootmsg.txt
        else
          echo $SCRIPT" module cs89x0 loaded with reset" >>/bootmsg.txt
        fi
      fi
    ;;
    *_cs)
      echo $drv should be loaded by pcmcia cardmgr ...
    ;;
    *)
      do_insmod $drv $opt
    ;;
  esac
done

end_script
