home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 16 / hacker16 / 16_HACKER16.ISO / linux / tpm-security-server-1.2.1.iso / archive / etc / rc.d / init.d / discovermodules < prev    next >
Encoding:
Text File  |  2004-01-29  |  3.9 KB  |  183 lines

  1. #!/bin/sh
  2.  
  3. . /etc/init.d/functions
  4.  
  5. if [ -e /etc/interactiveboot ]; then
  6.         echo "Automatically load ethernet modules?"
  7.         read A
  8.         if [ "x$A" = "xn" -o "x$A" = "xN" ]; then
  9.                 exit 0
  10.         fi
  11. fi
  12.  
  13. INDEX=`cat /proc/pci |grep "Ethernet controller:" |wc -l`
  14. ETHERNETS=`cat /proc/pci |grep "Ethernet controller:" |cut -d":" -f2 |tr " " "_"`
  15. LIST=""
  16.  
  17. if [ -e /etc/watchboot ]; then
  18.     echo "101000: Press Enter to Continue"
  19.     read A
  20. fi
  21.  
  22. for I in $ETHERNETS; do 
  23.     logger -p kern.info "Ethernet controller: $I"
  24.  
  25.     case "$I" in
  26.         *[Vv][Ii][Aa]*)
  27.             echo "Adding VIA to probe list"
  28.             LIST="via-rhine $LIST"
  29.                     ;;
  30.             *[Ll][Ii][Nn][Kk][Ss][Yy][Ss]*)
  31.             echo "Adding Linksys to probe list"
  32.             LIST="tulip $LIST"
  33.             ;;
  34.  
  35.             *3[Cc]501*)
  36.             echo "Adding 3c501 to probe list"
  37.             LIST="3c501 $LIST"
  38.             ;;
  39.  
  40.             *3[Cc]503*)
  41.             echo "Adding 3c503 to probe list"
  42.             LIST="3c503 $LIST"
  43.             ;;
  44.  
  45.             *3[Cc]505*)
  46.             echo "Adding 3c505 to probe list"
  47.             LIST="3c505 $LIST"
  48.             ;;
  49.  
  50.             *3[Cc]507*)
  51.             echo "Adding 3c507 to probe list"
  52.             LIST="3c507 $LIST"
  53.             ;;
  54.  
  55.             *3[Cc]509*)
  56.             echo "Adding 3c509 to probe list"
  57.             LIST="3c509 $LIST"
  58.             ;;
  59.  
  60.             *3[Cc]515*)
  61.             echo "Adding 3c515 to probe list"
  62.             LIST="3c515 $LIST"
  63.             ;;
  64.  
  65.             *3[Cc]590*|*3[Cc]592*|*3[Cc]595*|*3[Cc]597*)
  66.             echo "Adding 3c59x to probe list"
  67.             LIST="3c59x $LIST"
  68.             ;;
  69.  
  70.             *3[Cc]905*|*3[Cc]900*|*3[Cc]980*|*3[Cc][Ss][Oo][Hh][Oo]100*)
  71.             echo "Adding 3c59x to probe list"
  72.             LIST="3c59x $LIST"
  73.             ;;
  74.  
  75.             *3[Cc]55[56]*|*3[Cc]575*|*3[Cc]450*|*3[Cc]920*|*3[Cc]982*)
  76.             echo "Adding 3c59x to probe list"
  77.             LIST="3c59x $LIST"
  78.             ;;
  79.  
  80.         *3[Cc][Oo][Mm]*)
  81.             echo "Adding 3Com to probe list"
  82.             LIST="3c501 3c503 3c505 3c507 3c509 3c515 3c59x 3c589 3c574 $LIST"
  83.                     ;;
  84.  
  85.         *82557*)
  86.             echo "Adding Intel Ethernet Pro 100 to probe list"
  87.             LIST="eepro100 $LIST"
  88.                     ;;            
  89.  
  90.         *8139*)
  91.             echo "Adding RealTek RTL-8139 to probe list"
  92.             LIST="8139too $LIST"
  93.                     ;;            
  94.  
  95.         *82596*)
  96.             echo "Adding 82596 to probe list"
  97.             LIST="82596 $LIST"
  98.                     ;;            
  99.  
  100.         *[Rr][Tt][Ll]8002*)
  101.             echo "Adding Realtek Parallel to probe list"
  102.             LIST="atp $LIST"
  103.                     ;;            
  104.  
  105.  
  106.         *[Dd][Ll]2000*)
  107.             echo "Adding D-Link DL2000 to probe list"
  108.             LIST="dl2k $LIST"
  109.                     ;;            
  110.  
  111.  
  112.         *[Nn][Ee]2000*)
  113.             echo "Adding PCI NE2000 to probe list"
  114.             LIST="ne2k-pci ne $LIST"
  115.                     ;;            
  116.  
  117.         *[Nn][Ee]1000*)
  118.             echo "Adding NE1000/NE2000 ISA/PnP to probe list"
  119.             LIST="ne ne2k-pci $LIST"
  120.                     ;;            
  121.  
  122.         *[Ww][Dd]80[01]3*)
  123.             echo "Adding SMC Elite to probe list"
  124.             LIST="wd $LIST"
  125.                     ;;            
  126.  
  127.         *[Ww]89[Cc]840*)
  128.             echo "Adding Winbond W89c840 to probe list"
  129.             LIST="winbond-840 $LIST"
  130.                     ;;            
  131.  
  132.  
  133.         *[Uu][Ll][Tt][Rr][Aa]*)
  134.             echo "Adding SMC Ultra to probe list"
  135.             LIST="smc-ultra $LIST"
  136.                     ;;            
  137.  
  138.         *[Pp][Cc][Nn][Ee][Tt]*)
  139.             echo "Adding PCNet 32"
  140.             LIST="pcnet32 $LIST"
  141.                     ;;            
  142.  
  143.         *[Ss][Ii][Ss]900*)
  144.             echo "Adding SiS900"
  145.             LIST="sis900 $LIST"
  146.             ;;
  147.  
  148.         *)
  149.             continue
  150.             ;;
  151.     esac
  152. done
  153. echo "Probing Ethernet modules"
  154.  
  155. if [ "x$LIST" = "x" ] ; then
  156.     LIST="3c501 3c503 3c505 3c507 3c509 3c515 3c59x via-rhine eepro100 tulip smc9194 smc-ultra wd ne2k-pci 8139too sis900 acenic dl2k e1000 ns83820 3c589 3c574 smc91c92 xirc2ps_cs"
  157. fi
  158.  
  159.  
  160. I=0
  161. for DEVICE in $LIST ; do
  162.     if [ -e /etc/watchboot ]; then
  163.         echo "101050: Press Enter to Continue"
  164.         read A
  165.     fi
  166.  
  167.     echo -n "Probing for $DEVICE..."
  168.     logger -p kern.info "Attempting to load module $DEVICE..."
  169.     modprobe -q -s $DEVICE 2> /dev/null 1>/dev/null
  170.     if [ $? -eq 0 ] ; then
  171.         echo "Found and loading"
  172.         insmod $DEVICE
  173.         logger -p kern.info "Successfully loaded module $DEVICE"
  174.         let I++
  175.         if [ $I -ge $INDEX ]; then break; fi
  176.     else
  177.         logger -p kern.info "Could not load module $DEVICE"
  178.         echo "Not Found"
  179.     fi
  180. done
  181.  
  182. #LIST=`ls -1 /lib/modules/2.4.22/kernel/drivers/net | awk -F. '{ print $1 }'`
  183.