slitaz-tools rev 196
netbox: add wifi support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri May 16 00:12:07 2008 +0000 (2008-05-16) |
parents | 9c469ae182bc |
children | 30a71ce39bda |
files | tinyutils/netbox |
line diff
1.1 --- a/tinyutils/netbox Fri May 16 00:57:36 2008 +0200 1.2 +++ b/tinyutils/netbox Fri May 16 00:12:07 2008 +0000 1.3 @@ -94,8 +94,7 @@ 1.4 <label> 1.5 "Netbox let you manage network connections getting dynamic IP by DHCP 1.6 or static IP, and setup servers. Netbox can start or stop networking, 1.7 -configure network interfaces or directly edit files. Wifi users may 1.8 -configure System wide / Network." 1.9 +configure network interfaces or directly edit files. 1.10 </label> 1.11 </text> 1.12 </frame> 1.13 @@ -194,7 +193,9 @@ 1.14 </hbox> 1.15 </frame> 1.16 1.17 - <notebook labels="DHCP|PPPoE|Static IP|System wide|VPN|Servers' 1.18 + <notebook labels="DHCP|PPPoE|Static IP' 1.19 +[ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX|Wifi" 1.20 +NET_BOX="$NET_BOX|System wide|VPN|Servers" 1.21 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall" 1.22 tmp='|Etherwake"> 1.23 1.24 @@ -345,9 +346,135 @@ 1.25 <action>ifconfig $INTERFACE down; echo "done"</action> 1.26 </button> 1.27 </hbox> 1.28 - </frame> 1.29 - 1.30 - <frame Configuration files> 1.31 + </frame>' 1.32 +NET_BOX="$NET_BOX$tmp" 1.33 +tmp='<frame Wireless> 1.34 + <notebook labels="Interface|Extra parameters' 1.35 +[ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp|Kernel Modules" 1.36 +[ -x /usr/sbin/ndiswrapper ] && tmp="$tmp|Ndiswrapper" 1.37 +tmp2='"> 1.38 + <vbox> 1.39 + <hbox> 1.40 + <text use-markup="true"> 1.41 + <label>"<b>Interface :</b>"</label> 1.42 + </text> 1.43 + <entry> 1.44 + <input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input> 1.45 + <variable>WIFI_INTERFACE</variable> 1.46 + </entry> 1.47 + </hbox> 1.48 + <hbox> 1.49 + <text use-markup="true"> 1.50 + <label>"<b>ESSID :</b>"</label> 1.51 + </text> 1.52 + <entry> 1.53 + <input>. /etc/network.conf; echo "$WIFI_ESSID"</input> 1.54 + <variable>WIFI_ESSID</variable> 1.55 + </entry> 1.56 + </hbox> 1.57 + </vbox> 1.58 + <vbox> 1.59 + <hbox> 1.60 + <text use-markup="true"> 1.61 + <label>"<b>Channel :</b>"</label> 1.62 + </text> 1.63 + <entry> 1.64 + <input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input> 1.65 + <variable>WIFI_CHANNEL</variable> 1.66 + </entry> 1.67 + <text use-markup="true"> 1.68 + <label>"<b>Mode :</b>"</label> 1.69 + </text> 1.70 + <combobox> 1.71 + <variable>WIFI_MODE</variable>' 1.72 +. /etc/network.conf 1.73 +tmp2="$tmp2<item>$WIFI_MODE</item>" 1.74 +for i in managed ad-hoc master repeater secondary monitor; do 1.75 + [ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>" 1.76 +done 1.77 +tmp3='</combobox> 1.78 + </hbox> 1.79 + <hbox> 1.80 + <text use-markup="true"> 1.81 + <label>"<b>Key :</b>"</label> 1.82 + </text> 1.83 + <entry> 1.84 + <input>. /etc/network.conf; echo "$WIFI_KEY"</input> 1.85 + <variable>WIFI_KEY</variable> 1.86 + </entry> 1.87 + </hbox> 1.88 + </vbox>' 1.89 +tmp="$tmp$tmp2$tmp3" 1.90 +tmp2='<vbox> 1.91 + <hbox> 1.92 + <button> 1.93 + <label>Load</label> 1.94 + <input file icon="forward"></input> 1.95 + <action>modprobe $MODULE</action> 1.96 + </button> 1.97 + <button> 1.98 + <label>Unload</label> 1.99 + <input file icon="forward"></input> 1.100 + <action>modprobe -r $MODULE</action> 1.101 + </button> 1.102 + <text use-markup="true"> 1.103 + <label>"<b>Wifi Module :</b>"</label> 1.104 + </text> 1.105 + <combobox> 1.106 + <variable>MODULE</variable>' 1.107 +tmp2="$tmp2$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f | sed 's,/.*/\(.*\).ko.gz,<item>\1</item>,')" 1.108 +tmp3='</combobox> 1.109 + <button> 1.110 + <label>Lsmod</label> 1.111 + <input file icon="computer"></input> 1.112 + <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action> 1.113 + </button> 1.114 + </hbox> 1.115 + </vbox>' 1.116 +[ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp$tmp2$tmp3" 1.117 +tmp2='<vbox> 1.118 + <hbox> 1.119 + <text use-markup="true"> 1.120 + <label>"<b>Drivers :</b>"</label> 1.121 + </text> 1.122 + <entry> 1.123 + <input>. /etc/network.conf; echo "$NDISWRAPPER_DRIVERS"</input> 1.124 + <variable>NDISWRAPPER_DRIVERS</variable> 1.125 + </entry> 1.126 + <button> 1.127 + <label>Restart</label> 1.128 + <input file icon="reload"></input> 1.129 + <action>rmmod ndiswrapper</action> 1.130 + <action>for i in $NDISWRAPPER_DRIVERS; do ndiswrapper -i $i; done</action> 1.131 + <action>modprobe ndiswrapper</action> 1.132 + </button> 1.133 + </hbox> 1.134 + </vbox>' 1.135 +[ -x /usr/sbin/ndiswrapper ] && tmp="$tmp$tmp2" 1.136 +tmp2='</notebook> 1.137 + <hbox> 1.138 + <button> 1.139 + <label>Start</label> 1.140 + <input file icon="forward"></input> 1.141 + <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_INTERFACE=`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action> 1.142 + <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_ESSID=`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action> 1.143 + <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_KEY=`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action> 1.144 + <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_MODE=`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action> 1.145 + <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_CHANNEL=`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action> 1.146 + <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action> 1.147 + <action>ifconfig $WIFI_INTERFACE down</action> 1.148 + <action>/etc/init.d/network.sh</action> 1.149 + </button> 1.150 + <button> 1.151 + <label>Stop</label> 1.152 + <input file icon="stop"></input> 1.153 + <action>ifconfig $WIFI_INTERFACE down</action> 1.154 + <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action> 1.155 + </button> 1.156 + </hbox> 1.157 + </frame>' 1.158 +[ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX$tmp$tmp2" 1.159 +tmp='<frame Configuration files> 1.160 <hbox> 1.161 <text use-markup="true"> 1.162 <label>"<b>Hosts :</b>"</label>