2 # Filename: ndiswrapper.sh
3 # Purpose: NdisWrapper configuration script
4 # Authors: (c) Martin Oehler 2004, (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Fri Apr 21 22:22:12 CEST 2006 [mika]
8 ################################################################################
10 PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin"
14 if [ $UID != 0 ] ; then
15 echo Error: become root before starting $0 >& 2
20 # XDIALOG_HIGH_DIALOG_COMPAT=1
21 # export XDIALOG_HIGH_DIALOG_COMPAT
22 # XDIALOG_FORCE_AUTOSIZE=1
23 # export XDIALOG_FORCE_AUTOSIZE
28 # [ -n "$DISPLAY" ] && [ -x /usr/bin/Xdialog ] && DIALOG="Xdialog"
30 BACKTITLE="GRML NDISWRAPPER TOOL"
32 # this error is displayed when something is wrong eith the
35 $DIALOG --title "$BACKTITLE" --backtitle "ERROR" --msgbox "The selected file is no *.inf file or the *.inf file is invalid, exiting." 12 75;
39 # at first we show the usual disclaimer that the usage of this
40 # script could simply destroy everything
42 # dialog doesn't knows --center
43 if [ "$DIALOG" = "dialog" ]; then
44 $DIALOG --title "$BACKTITLE" --backtitle "DISCLAIMER" --msgbox "This is the configuration tool for the ndiswrapper utilities. \n
45 Be aware that loading a windows driver file for your wlan \n
46 card using this tool could freeze your system. \n
48 You need matching driver.inf and driver.sys files residing on \n
49 a mounted data medium. After the windows drivers have been \n
50 successfully loaded via the ndiswrapper, you have to configure \n
51 your wlan settings via iwconfig. Future releases of this script \n
54 Please send your feedback to <oehler@knopper.net>" 16 75;
56 $DIALOG --center --title "$BACKTITLE" --backtitle "DISCLAIMER" --msgbox "This is the configuration tool for the ndiswrapper utilities. \n
57 Be aware that loading a windows driver file for your \n
58 wlan card using this tool could freeze your system. \n
60 You need matching driver.inf and driver.sys files residing on \n
61 a mounted data medium. After the windows drivers have been \n
62 successfully loaded via the ndiswrapper, you have to configure \n
63 your wlan settings via iwconfig. Future releases of this script \n
66 Please send your feedback to \n
67 <oehler@knopper.net>" 12 75;
70 $DIALOG --title "$BACKTITLE" --backtitle "SELECT <DRIVER>.INF FILE" --fselect "/home/grml" 12 75 2>"$TMP"; read DRIVER_PATH <"$TMP"; rm -f "$TMP";
72 test -x "/usr/sbin/ndiswrapper" || { echo "NdisWrapper not found, exiting." >&2; exit 1; }
73 test -x "/sbin/modprobe" || { echo "modprobe not found, exiting." >&2; exit 1; }
74 test -e $DRIVER_PATH || { echo "$DRIVER_PATH does not exist, exiting." >&2; exit 1; }
75 case "$DRIVER_PATH" in
76 *\.inf*) NUM=`grep -c "sys" "$DRIVER_PATH"`
77 if [ "$NUM" -lt 1 ]; then
83 # how much lines are in /proc/net/wireless
84 LINES1=`cat /proc/net/wireless | wc -l`
86 ndiswrapper -i $DRIVER_PATH
90 # have we got a new device?
91 LINES2=`cat /proc/net/wireless | wc -l`
93 if [ "$LINES2" -gt "$LINES1" ]; then
94 $DIALOG --title "$BACKTITLE" --backtitle "RESULT" --msgbox "The ndiswrapper module has been loaded. You may configure your wlan card with iwconfig now." 12 75 2>"$TMP"; [ "$?" != "0" ] && return 1; rm -f "$TMP";
96 $DIALOG --title "$BACKTITLE" --backtitle "RESULT" --msgbox "The ndiswrapper module has been loaded but there is no new device. Perhaps NdisWrapper is not working with your driver file." 12 75 2>"$TMP"; [ "$?" != "0" ] && return 1; rm -f "$TMP";
99 ## END OF FILE #################################################################