slitaz-tools view tinyutils/wifibox @ rev 312

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