#!/bin/sh
# ndiswrapper 1.55 kernel driver builder 

KERNEL=`uname -r`

case "$1" in
install)
echo -e "\E[0;32m+--------------------------------------------------------------+\E[0;0m"
echo -e "\E[0;32m Building ndisdriver for `uname -s -r` \E[0;0m"
echo -e "\E[0;32m+--------------------------------------------------------------+\E[0;0m"
(
cd /usr/src/ndiswrapper/
tar -xzf driver.tar.gz
make -C driver install
rm -rf driver

)
;;

uninstall)
echo -e "\E[0;32m+--------------------------------------------------------------+\E[0;0m"
echo -e "\E[0;32m Removing ndisdriver from `uname -s -r` \E[0;0m"
echo -e "\E[0;32m+--------------------------------------------------------------+\E[0;0m"
for module in `find /lib/modules/$KERNEL -type f | grep 'ndiswrapper.\(\(ko\)\|\(o\)\)'`; do
echo "removing $module";
/bin/rm -f $module;
done
;;

*)
echo "Usage: $0 {install|uninstall}"
exit 1
;;
esac

