#!/bin/bash
# helper script load/unload modules 
# (c) Konstantin Antselovich
 
MODULE_LIST='ieee80211_crypt-r8180 ieee80211_crypt_wep-r8180 ieee80211-r8180 r8180';
 

# check if we are root
#
if [ $EUID -ne 0 ]; then
  echo "Error: only root can load/unload modules"
  exit 1
fi 

# load crc32 module 
#
/sbin/modprobe -v crc32 > /dev/null 2>&1

# check what kernel we are running and load the rest of the modules
#
if [ $(grep -c '2.6' /proc/version) -gt 0 ]; then
       # kernel 2.6
       for i in $MODULE_LIST;
       do
               /sbin/insmod $i.ko
       done
elif [ $(grep -c '2.4' /proc/version) -gt 0]; then
       #kernel 2.4 
       for i in $MODULE_LIST;
        do
                /sbin/insmod $i.o
        done
else 
       echo "We do not support kernel version $(uname -r)";
       exit 1;
fi

exit 0;