flavors view core/rootfs/usr/bin/wifibox @ rev 15

Keep 4 flavors + loram + 3in1 and add tmp addfiles for core
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 02 22:26:52 2010 +0100 (2010-02-02)
parents
children
line source
1 #!/bin/sh
2 #
3 # GTKdialog interface to manage wireless connections in a simple way.
4 # Use tabs to indent, split commands from the GUI and use functions.
5 # Favorite networks are also supported
6 #
7 # (c) 2010 SliTaz GNU/Linux - GNU gpl v3
8 #
9 VERSION=20100118
11 # Export script path and others if needed so we can use them in 'quote'.
12 export BIN=$0
13 export FAVORITES_WIFI=/etc/wireless
14 . /etc/network.conf
16 # Wifibox is only for root.
17 if test $(id -u) != 0 ; then
18 exec subox wifibox
19 exit 0
20 fi
22 # Sanity check
23 [ -x /usr/sbin/iwconfig ] || tazpkg get-install wireless_tools
24 [ -d $FAVORITES_WIFI ] || mkdir -p $FAVORITES_WIFI
25 rm -f $FAVORITES_WIFI/any.conf
27 # Catch ESSIDs and format output for GTK tree. We get the list of
28 # networks by Cell and without spaces.
29 detect_wifi_networks()
30 {
31 desktopbox notify "Scanning Wireless interface: $WIFI_INTERFACE" &
32 if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
33 ifconfig $WIFI_INTERFACE up
34 for i in `iwlist $WIFI_INTERFACE scan | sed s/"Cell "/Cell-/ | grep "Cell-" | awk '{print $1}'`
35 do
36 SCAN=`iwlist $WIFI_INTERFACE scan last | \
37 awk '/(Cell|ESS|Qual|Encry|IE: WPA)/ {print}' | \
38 sed s/"Cell "/Cell-/ | grep -A 5 "$i"`
39 ESSID=`echo $SCAN | cut -d '"' -f 2`
40 if echo "$SCAN" | grep -q Quality; then
41 QUALITY=`echo $SCAN | sed 's/.*Quality=\([^ ]*\).*/\1/' | sed 's/.*Quality:\([^ ]*\).*/\1/'`
42 else
43 QUALITY="-"
44 fi
45 ENCRYPTION=`echo $SCAN | sed 's/.*key:\([^ ]*\).*/\1/'`
46 # Check encryption type
47 if echo "$SCAN" | grep -q WPA; then
48 ENCRYPTION="${ENCRYPTION} (WPA)"
49 fi
50 # Connected or not connected...
51 if ifconfig | grep -A 1 $WIFI_INTERFACE | \
52 grep -q inet && iwconfig $WIFI_INTERFACE | \
53 grep ESSID | grep -q -w "$ESSID"; then
54 STATUS=connected
55 else
56 STATUS="-"
57 fi
58 echo -n ""
59 echo "$ESSID | $QUALITY | $ENCRYPTION | $STATUS"
60 done
61 fi
62 }
64 # cmdline functions
66 # Toggle Software RF Switch on some laptops
67 set_rfswitch()
68 {
69 for i in /proc/driver/acerhk/wirelessled /proc/acpi/asus/wled ; do
70 [ -e $i ] && echo $1 > $i
71 done
72 }
74 # Configure /etc/network.conf and restart connection with init script.
75 start_wifi_connection()
76 {
77 # Get tmp config created by connect_to_essid() if exists and set
78 # empty value to clean config file.
79 if [ -f /tmp/wifi.conf ]; then
80 . /tmp/wifi.conf
81 WIFI_MODE=""
82 WIFI_IWCONFIG_ARGS=""
83 WIFI_CHANNEL=""
84 fi
85 sed -i "s/`grep ^WIFI= /etc/network.conf`/WIFI=\"yes\"/" \
86 /etc/network.conf
87 sed -i "s/`grep ^WIFI_INTERFACE= /etc/network.conf`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/" \
88 /etc/network.conf
89 sed -i "s/`grep ^WIFI_ESSID= /etc/network.conf`/WIFI_ESSID=\"$WIFI_ESSID\"/" \
90 /etc/network.conf
91 sed -i "s/`grep ^WIFI_KEY= /etc/network.conf`/WIFI_KEY=\"$WIFI_KEY\"/" \
92 /etc/network.conf
93 sed -i "s/`grep ^WIFI_MODE= /etc/network.conf`/WIFI_MODE=\"$WIFI_MODE\"/" \
94 /etc/network.conf
95 sed -i "s/`grep ^WIFI_IWCONFIG_ARGS= /etc/network.conf`/WIFI_IWCONFIG_ARGS=\"$WIFI_IWCONFIG_ARGS\"/" \
96 /etc/network.conf
97 sed -i "s/`grep ^WIFI_KEY_TYPE= /etc/network.conf`/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/" \
98 /etc/network.conf
99 sed -i "s/`grep ^WIFI_CHANNEL= /etc/network.conf`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/" \
100 /etc/network.conf
101 [ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`
102 ifconfig $WIFI_INTERFACE down
103 set_rfswitch 1
104 iwconfig $WIFI_INTERFACE txpower auto
105 /etc/init.d/network.sh restart
106 # Remove tmp file (could be used to have wireless profiles)
107 rm -f /tmp/wifi.conf
108 sleep 2
109 }
111 # We must sleep 4 sec to refresh networks list.
112 stop_wifi_connexion()
113 {
114 sed -i s/`grep ^WIFI= /etc/network.conf`/WIFI=\"no\"/ \
115 /etc/network.conf
116 [ -x /etc/init.d/wpa_supplicant ] && /etc/init.d/wpa_supplicant stop
117 ifconfig $WIFI_INTERFACE down
118 iwconfig $WIFI_INTERFACE txpower off
119 set_rfswitch 0
120 [ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`
121 sleep 2
122 }
124 # Favorite wireless networks use only 3 values: essid. key and type of
125 # key
126 favorites_wifi_list()
127 {
128 for i in $FAVORITES_WIFI/*.conf
129 do
130 WIFI_ESSID=""
131 WIFI_KEY=""
132 WIFI_KEY_TYPE=""
133 . "$i"
134 [ -z "$WIFI_ESSID" ] && WIFI_ESSID="Bad config file: $i"
135 [ -z "$WIFI_KEY_TYPE" ] && WIFI_KEY_TYPE="-"
136 if [ -n "$WIFI_KEY" ]; then
137 WIFI_KEY="********"
138 else
139 WIFI_KEY="-"
140 fi
141 echo "$WIFI_ESSID | $WIFI_KEY_TYPE | $WIFI_KEY"
142 done
143 }
145 favorite_wifi_actions()
146 {
147 cp -a $FAVORITES_WIFI/"$FAVORITE".conf /tmp/wifi.conf
148 . /tmp/wifi.conf
149 export CONNECT_FAVORITE="
150 <window title=\"Connect to: $WIFI_ESSID\" icon-name=\"network-wireless\">
151 <vbox>
153 <text width-chars=\"54\">
154 <label>
155 \"
156 ESSID name: $WIFI_ESSID
157 \"
158 </label>
159 </text>
161 <hbox>
162 <button>
163 <label>Connect</label>
164 <input file icon=\"forward\"></input>
165 <action>$0 start_wifi_connection</action>
166 <action type=\"exit\">exit</action>
167 </button>
168 <button>
169 <label>Edit settings</label>
170 <input file icon=\"accessories-text-editor\"></input>
171 <action>leafpad $FAVORITES_WIFI/\"$FAVORITE\".conf</action>
172 <action>rm -f /tmp/wifi.conf</action>
173 <action type=\"exit\">exit</action>
174 </button>
175 <button>
176 <label>Delete</label>
177 <input file icon=\"gtk-delete\"></input>
178 <action>rm -f $FAVORITES_WIFI/\"$FAVORITE\".conf</action>
179 <action type=\"exit\">exit</action>
180 </button>
181 <button cancel></button>
182 </hbox>
184 </vbox>
185 </window>"
186 gtkdialog --center --program=CONNECT_FAVORITE >/dev/null
187 }
189 add_favorite_network_box()
190 {
191 ADD_FAVORITE='
192 <window title="Add new favorite Wireless" icon-name="network-wireless">
193 <vbox>
194 <text width-chars="54">
195 <label>
196 "
197 Please configure your new favorite Wireless network
198 "
199 </label>
200 </text>
201 <hbox>
202 <text use-markup="true">
203 <label>"<b>ESSID:</b>"</label>
204 </text>
205 <entry>
206 <variable>WIFI_ESSID</variable>
207 </entry>
208 </hbox>
209 <hbox>
210 <text use-markup="true">
211 <label>"<b>Key: </b>"</label>
212 </text>
213 <entry>
214 <variable>WIFI_KEY</variable>
215 </entry>
216 </hbox>
217 <hbox>
218 <text use-markup="true">
219 <label>"<b>Key type:</b>"</label>
220 </text>
221 <combobox>'
222 tmp="${ADD_FAVORITE}<item>$WIFI_KEY_TYPE</item>"
223 for i in none WEP WPA any; do
224 tmp=${tmp}"<item>$i</item>"
225 done
226 export ADD_FAVORITE=${tmp}'
227 <variable>WIFI_KEY_TYPE</variable>
228 </combobox>
229 </hbox>
230 <hbox>
231 <button>
232 <label>Add to list</label>
233 <input file icon="forward"></input>
234 <action>echo "# Wireless connection configuration." > $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
235 <action>echo "#" >> /etc/wireless/"$WIFI_ESSID".conf</action>
236 <action>echo "WIFI_ESSID=\"$WIFI_ESSID\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
237 <action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
238 <action>echo "WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"" >> $FAVORITES_WIFI/"$WIFI_ESSID".conf</action>
239 <action type="exit">exit</action>
240 </button>
241 <button cancel></button>
242 </hbox>
243 </vbox>
244 </window>'
245 gtkdialog --center --program=ADD_FAVORITE #>/dev/null
246 }
248 # GUI functions
250 helpbutton()
251 {
252 local label;
253 label="<label>$3</label>"
254 [ -n "$3" ] || label=""
255 cat << EOT
256 <button>
257 <input file icon="help"></input>$label
258 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry $2 -title "$1 help" -e "$(which $1) --help ; echo -e \\"----\\nENTER to continue...\\" && read close"</action>
259 </button>
260 EOT
261 }
263 manbutton()
264 {
265 cat << EOT
266 <button>
267 <input file icon="browser"></input>
268 <label>man</label>
269 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
270 </button>
271 EOT
272 }
274 # Independant dialog to connect on a wireless network. If encryption
275 # is on we ask for the security key.
276 connect_to_essid()
277 {
278 SCAN=`iwlist $WIFI_INTERFACE scan | \
279 awk '/(Cell|ESS|Qual|Encry|IE: WPA)/ {print}' | \
280 grep -B 1 -A 1 "$ESSID_LIST"`
281 WIFI_ESSID="$ESSID_LIST"
282 ENCRYPTION=`echo $SCAN | sed 's/.*key:\([^ ]*\).*/\1/'`
283 # Create tmp file used by active_wifi_connexion()
284 cat > /tmp/wifi.conf << _EOF_
285 # Wireless connexion configuration file.
286 WIFI_ESSID="$ESSID_LIST"
287 _EOF_
288 CONNECT_ESSID="
289 <window title=\"Connect to: $WIFI_ESSID\" icon-name=\"network-wireless\">
290 <vbox>
291 <text width-chars=\"54\">
292 <label>
293 \"
294 Connect $WIFI_INTERFACE to: $WIFI_ESSID
295 \"
296 </label>
297 </text>"
298 # We maybe need a key to connect
299 if [ "$ENCRYPTION" = "on" ] && [ "$ESSID_LIST" != "any" ]; then
300 # WPA
301 if echo "$SCAN" | grep -q WPA; then
302 echo 'WIFI_KEY_TYPE="WPA"' >> /tmp/wifi.conf
303 CONNECT_ESSID=${CONNECT_ESSID}'
304 <hbox>
305 <text use-markup="true">
306 <label>"<b>WPA Key:</b>"</label>
307 </text>
308 <entry>
309 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
310 <variable>WIFI_KEY</variable>
311 </entry>
312 </hbox>'
313 else
314 # WEP
315 echo 'WIFI_KEY_TYPE="WEP"' >> /tmp/wifi.conf
316 CONNECT_ESSID=${CONNECT_ESSID}'
317 <hbox>
318 <text use-markup="true">
319 <label>"<b>WEP Key:</b>"</label>
320 </text>
321 <entry>
322 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
323 <variable>WIFI_KEY</variable>
324 </entry>
325 </hbox>'
326 fi
327 else
328 # No encryption
329 echo 'WIFI_KEY=""' >> /tmp/wifi.conf
330 echo 'WIFI_KEY_TYPE=""' >> /tmp/wifi.conf
331 start_wifi_connection
332 exit 0
333 fi
334 # Add key to config file so active_wifi_connexion() can use it.
335 # WIFI_KEY is not exported if we quote with --> "
336 export CONNECT_ESSID=${CONNECT_ESSID}'
337 <hbox>
338 <button>
339 <label>Connect</label>
340 <input file icon="forward"></input>
341 <action>echo "WIFI_KEY=\"$WIFI_KEY\"" >> /tmp/wifi.conf</action>
342 <action>$BIN start_wifi_connection</action>
343 <action type="exit">exit</action>
344 </button>
345 <button cancel></button>
346 </hbox>
347 </vbox>
348 </window>'
349 gtkdialog --center --program=CONNECT_ESSID #>/dev/null
350 }
352 # Wifibox start with Networks tab.
353 box()
354 {
355 WIFI_DIALOG="
356 <window title=\"Wireless manager\" icon-name=\"network-wireless\">
357 <vbox>
359 <notebook labels=\"Networks|Favorites|Configuration|Drivers\">
361 <vbox>
362 <tree icon=\"network-wireless\">
363 <width>520</width><height>160</height>
364 <variable>ESSID_LIST</variable>
365 <label>ESSID|Quality|Encryption|Status</label>
366 <input>$0 detect_wifi_networks</input>
367 <item icon=\"network-wireless\">any | * | off | (auto-connect)</item>
368 <action>$0 connect_to_essid</action>
369 <action>refresh:ESSID_LIST</action>
370 <action>refresh:WIFI_ESSID</action>
371 <action>refresh:WIFI_KEY</action>
372 <action>refresh:WIFI_KEY_TYPE</action>
373 </tree>
374 <hbox>
375 <text width-chars=\"54\">
376 <label>
377 \"Please double click on a network to connect or enter security key\"
378 </label>
379 </text>
380 <button>
381 <label>Refresh list</label>
382 <input file icon=\"reload\"></input>
383 <action>refresh:ESSID_LIST</action>
384 </button>
385 </hbox>
386 </vbox>"
388 # Favorite networks
389 WIFI_DIALOG=${WIFI_DIALOG}"
390 <vbox>
391 <tree icon=\"network-wireless\">
392 <width>500</width><height>160</height>
393 <variable>FAVORITE</variable>
394 <label>ESSID|Key Type|Key status</label>
395 <input>$0 favorites_wifi_list</input>
396 <item icon=\"network-wireless\">any | - | -</item>
397 <action>$0 favorite_wifi_actions</action>
398 <action>refresh:FAVORITE</action>
399 <action>refresh:ESSID_LIST</action>
400 <action>refresh:WIFI_ESSID</action>
401 <action>refresh:WIFI_KEY</action>
402 <action>refresh:WIFI_KEY_TYPE</action>
403 </tree>
404 <hbox>
405 <text width-chars=\"50\">
406 <label>
407 \"Please double click on a network to modify or remove it\"
408 </label>
409 </text>
410 <button>
411 <label>Add Network</label>
412 <input file icon=\"gtk-add\"></input>
413 <action>$0 add_favorite_network_box</action>
414 <action>refresh:FAVORITE</action>
415 </button>
416 </hbox>
417 </vbox>"
419 # Configuration tab
420 WIFI_DIALOG=${WIFI_DIALOG}'
421 <vbox>
422 <frame Basic>
423 <hbox>
424 <text use-markup="true">
425 <label>"<b>Interface:</b>"</label>
426 </text>
427 <entry>
428 <input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
429 <variable>WIFI_INTERFACE</variable>
430 </entry>
431 </hbox>
432 <hbox>
433 <text use-markup="true">
434 <label>"<b>ESSID: </b>"</label>
435 </text>
436 <entry>
437 <input>. /etc/network.conf; echo "$WIFI_ESSID"</input>
438 <variable>WIFI_ESSID</variable>
439 </entry>
440 </hbox>
441 <hbox>
442 <text use-markup="true">
443 <label>"<b>Key: </b>"</label>
444 </text>
445 <entry>
446 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
447 <variable>WIFI_KEY</variable>
448 </entry>
449 <combobox>'
450 tmp2="${WIFI_DIALOG}<item>$WIFI_KEY_TYPE</item>"
451 for i in none WEP WPA any; do
452 [ "$i" = "$WIFI_KEY_TYPE" ] || tmp2="$tmp2<item>$i</item>"
453 done
454 tmp3=' <variable>WIFI_KEY_TYPE</variable>
455 </combobox>
456 </hbox>
457 </frame>
458 <frame Advanced>
459 <hbox>
460 <text use-markup="true">
461 <label>"<b>Channel/Mode:</b>"</label>
462 </text>
463 <entry>
464 <input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
465 <variable>WIFI_CHANNEL</variable>
466 </entry>
468 <combobox>
469 <variable>WIFI_MODE</variable>'
470 tmp2="$tmp2$tmp3<item>$WIFI_MODE</item>"
471 for i in managed ad-hoc master repeater secondary monitor; do
472 [ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
473 done
474 tmp3=' </combobox>
475 </hbox>
476 <hbox>
477 <text use-markup="true">
478 <label>"<b>Iwconfig args:</b> "</label>
479 </text>
480 <entry>
481 <input>. /etc/network.conf; echo "$WIFI_IWCONFIG_ARGS"</input>
482 <variable>WIFI_IWCONFIG_ARGS</variable>
483 </entry>'
484 WIFI_DIALOG="$tmp$tmp2$tmp3
485 $(helpbutton iwconfig 80x24)
486 $(manbutton 8 iwconfig)
487 </hbox>
488 </frame>"
490 # Start Button for manual configuration.
491 WIFI_DIALOG=${WIFI_DIALOG}'
492 <hbox>
493 <button>
494 <label>Start connection</label>
495 <input file icon="forward"></input>
496 <action>[ "$WIFI_KEY_TYPE" = "WPA" -a ! -x /usr/bin/wpa_supplicant ] && xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title "wpa_supplicant install" -e "tazpkg get-install wpa_supplicant ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
497 <action>sed -i s/`grep ^WIFI= /etc/network.conf`/WIFI=\"yes\"/ /etc/network.conf</action>
498 <action>sed -i s/`grep ^WIFI_INTERFACE= /etc/network.conf`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
499 <action>sed -i s/`grep ^WIFI_ESSID= /etc/network.conf`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
500 <action>sed -i s/`grep ^WIFI_KEY= /etc/network.conf`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
501 <action>sed -i s/`grep ^WIFI_MODE= /etc/network.conf`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
502 <action>sed -i "s/`grep ^WIFI_IWCONFIG_ARGS= /etc/network.conf`/WIFI_IWCONFIG_ARGS=\"$WIFI_IWCONFIG_ARGS\"/" /etc/network.conf</action>
503 <action>sed -i s/`grep ^WIFI_KEY_TYPE= /etc/network.conf`/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/ /etc/network.conf</action>
504 <action>sed -i s/`grep ^WIFI_CHANNEL= /etc/network.conf`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
505 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
506 <action>ifconfig $WIFI_INTERFACE down</action>
507 <action>iwconfig $WIFI_INTERFACE txpower auto</action>
508 <action>/etc/init.d/network.sh restart</action>
509 <action>refresh:ESSID_LIST</action>
510 <action>refresh:WIFI_ESSID</action>
511 <action>refresh:WIFI_KEY</action>
512 <action>refresh:WIFI_KEY_TYPE</action>
513 </button>
514 </hbox>
515 </vbox>'
517 # Kernel Modules, firmware and tazndisbox note + button.
518 WIFI_DIALOG=${WIFI_DIALOG}"
519 <vbox>
520 <hbox>
521 <text width-chars=\"64\">
522 <label>
523 \"
524 Some Wireless Adapters need non-free firmware. Please install the
525 firmware before loading the corresponding module. Note: you can use
526 Tazhw to automatically detect your PCI, PCMCIA or USB Wireless adapter.
527 \"
528 </label>
529 </text>
530 </hbox>
531 <hbox>
532 <text use-markup=\"true\">
533 <label>\"<b>Tools:</b>\"</label>
534 </text>
535 <button>
536 <input file icon=\"computer\"></input>
537 <label>Auto detect devices</label>
538 <action>tazhw box</action>
539 <action>refresh:ESSID_LIST</action>
540 </button>"
541 # Display firmware stuff, tazndisbox button if installed and close
542 # tab + notebook
543 if [ -x /usr/bin/tazndisbox ]; then
544 WIFI_DIALOG=${WIFI_DIALOG}"
545 <button>
546 <input file icon=\"system-installer\"></input>
547 <label>Install Windows driver</label>
548 <action>tazndisbox</action>
549 <action>refresh:ESSID_LIST</action>
550 </button>"
551 fi
552 WIFI_DIALOG=${WIFI_DIALOG}"
553 </hbox>
554 <hbox>
555 <text use-markup=\"true\">
556 <label>\"<b>Module:</b>\"</label>
557 </text>
558 <combobox>
559 <variable>MODULE</variable>"
560 WIFI_DIALOG="${WIFI_DIALOG}$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f 2> /dev/null | sed 's,/.*/\(.*\).ko.*,<item>\1</item>,')"
561 WIFI_DIALOG=${WIFI_DIALOG}'
562 </combobox>
563 <button>
564 <label>Load</label>
565 <input file icon="forward"></input>
566 <action>modprobe $MODULE</action>
567 </button>
568 <button>
569 <label>Unload</label>
570 <input file icon="undo"></input>
571 <action>modprobe -r $MODULE</action>
572 </button>
573 <button>
574 <label>Lsmod</label>
575 <input file icon="computer"></input>
576 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
577 </button>
578 </hbox>'
579 # Firmware stuff.
580 tmp=$(for i in /usr/bin/get*firmware; do
581 [ -x $i ] || continue
582 [ "$i" = "/usr/bin/get-wifi-firmware" ] && continue
583 [ -d /var/lib/tazpkg/installed/${i#/usr/bin/get-} ] && continue
584 echo "<item>${i#/usr/bin/get-}</item>"; done)
585 [ -n "$tmp" ] && tmp="
586 <hbox>
587 <text use-markup=\"true\">
588 <label>\"<b>Firmware:</b>\"</label>
589 </text>
590 <combobox><variable>FIRMWARE</variable>$tmp</combobox>
591 <button>
592 <label>Install</label>
593 <input file icon=\"go-jump\"></input>
594 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title \"Install \$FIRMWARE\" -e \"get-\$FIRMWARE\"</action>
595 <action>refresh:ESSID_LIST</action>
596 </button>
597 <button>
598 <input file icon=\"system-file-manager\"></input>
599 <label>List files</label>
600 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 100x25 -title \"Firmware files (q to quit)\" -e \"find /lib/firmware -exec ls -ld {} \; | less\"</action>
601 <action>refresh:ESSID_LIST</action>
602 </button>
603 </hbox>"
605 # Bottom buttons
606 export WIFI_DIALOG=${WIFI_DIALOG}${tmp}"
607 </vbox>
608 </notebook>
609 <hbox>
610 <button>
611 <label>Stop connection</label>
612 <input file icon=\"stop\"></input>
613 <action>$0 stop_wifi_connexion</action>
614 <action>refresh:ESSID_LIST</action>
615 </button>
616 <button>
617 <label>Exit</label>
618 <input file icon=\"exit\"></input>
619 <action type=\"exit\">Exit</action>
620 </button>
621 </hbox>
623 </vbox>
624 </window>"
625 gtkdialog --center --program=WIFI_DIALOG #>/dev/null 2>&1
626 }
628 if [ -n "$1" ]; then
629 $1
630 else
631 box
632 fi
634 exit 0