slitaz-tools view tinyutils/netbox @ rev 225

netbox: detect ESSID list
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jul 08 08:39:26 2008 +0000 (2008-07-08)
parents 8a61d6420e01
children 803ff10f67b2
line source
1 #!/bin/sh
2 #
3 # Gtkdialog box to manage network connexion.
4 # - SliTaz GNU/Linux 2008.
5 #
6 VERSION=20080113
8 # Check if user is root.
9 check_root()
10 {
11 if test $(id -u) != 0 ; then
12 echo -e "
13 You must be root to run `basename $0`. Please type 'su' and
14 root password to become super-user.\n"
15 exit 0
16 fi
17 }
19 set_ipup()
20 {
21 [ -f /etc/ppp/ip-up ] && return
22 cat > /etc/ppp/ip-up <<EOT
23 #!/bin/sh
24 exec $0 call ipup \$@
25 EOT
26 chmod +x /etc/ppp/ip-up
27 }
29 # Detect WIFI_INTERFACE and update /etc/network.conf
30 . /etc/network.conf
31 if ! iwconfig $WIFI_INTERFACE 2>&1 | grep -iq "essid"; then
32 WIFI_INTERFACE=$(grep : /proc/net/dev | cut -d: -f1 | \
33 while read dev; do iwconfig $dev 2>&1 | \
34 grep -iq "essid" && { echo $dev ; break; }; \
35 done)
36 [ -n "$WIFI_INTERFACE" ] && sed -i "s/^WIFI_INTERFACE=.*/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/" /etc/network.conf
37 fi
39 ESSIDS=""
40 # Detect ESSID list
41 if ! iwconfig $WIFI_INTERFACE 2>&1 | grep -iq "essid"; then
42 for i in $(iwlist $WIFI_INTERFACE scanning | grep "ESSID" | \
43 grep -v "<hidden>" | sed -n 's/ESSID:"//p' | sed -n 's/"//p'); do
44 ESSIDS="$ESSIDS<item>$linessid</item>"
45 done
46 fi
48 if [ "$1" = "call" ]; then
49 ppp="pppd local lock notty"
50 pppup=""
51 sub=$2
52 shift 2
53 case "$sub" in
54 sendsshkey)
55 check_root
56 dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | \
57 grep ^ssh | ssh $1 "mkdir .ssh 2> /dev/null ; while read key; do for i in authorized_keys authorized_keys2; do grep -q \$key .ssh/\$i || echo \$key >> .ssh/\$i; done; done; chmod 700 .ssh ; chmod 600 .ssh/authorized_keys*"
58 exit 0;;
59 vpnssh) check_root
60 set_ipup
61 ps ww | grep -q "$ppp $2:$3" && exit 1
62 pipe="/tmp/ssh$$"
63 mkfifo $pipe
64 [ -n "$4" ] && pppup="ipparam 'addroutes,$(echo $4 | sed 's/ /,/g')'"
65 cat $pipe | dbclient -i /etc/dropbear/dropbear_rsa_host_key \
66 $1 "$ppp" | $ppp $2:$3 $pppup > $pipe
67 rm -f $pipe
68 exit 0;;
69 killvpnssh)
70 check_root
71 kill $(ps x | grep dbclient | grep "$ppp" | awk '{ print $1 }')
72 exit 0;;
73 ipup)
74 # Arg Name Example
75 # $1 Interface name ppp0
76 # $2 The tty ttyS1
77 # $3 The link speed 38400
78 # $4 Local IP number 12.34.56.78
79 # $5 Peer IP number 12.34.56.99
80 # $6 Optional ``ipparam'' value foo
81 iface=$1
82 # skip tty if present
83 case "$2" in [0-9]*);; *) shift; esac
84 peer=$4
85 IFS=","; set -- $(eval echo $5); unset IFS
86 set -- $1
87 if [ "$1" = "addroutes" ]; then
88 while [ -n "$2" ]; do
89 eval $(ipcalc -n $2)
90 eval $(ipcalc -m $2)
91 route add -net $NETWORK netmask $NETMASK \
92 gw $peer $iface
93 shift
94 done
95 fi
96 exit 0;;
97 esac
98 echo "call $sub unsupported."
99 exit 1
100 fi
102 # English/French help dialod.
103 export HELP='
104 <window title="Network status" icon-name="network-wire">
105 <vbox>
106 <text use-markup="true">
107 <label>"
108 <b>SliTaz - Netbox</b>"
109 </label>
110 </text>
111 <frame English>
112 <text wrap="true" width-chars="58">
113 <label>
114 "Netbox let you manage network connections getting dynamic IP by DHCP
115 or static IP, and setup servers. Netbox can start or stop networking,
116 configure network interfaces or directly edit files."
117 </label>
118 </text>
119 </frame>
120 <frame Francais>
121 <text wrap="true" width-chars="58">
122 <label>
123 "Netbox vous permet de gerer les connexions reseau avec une IP
124 statique ou en obtenant une IP dynamique par DHCP, et de parametrer
125 les serveurs. Netbox peut demarrer ou arreter le reseau, configurer
126 les interfaces reseau ou editer directement les fichiers."
127 </label>
128 </text>
129 </frame>
130 </vbox>
131 </window>
132 '
134 # Interafce status with ifconfig without arguments to show all
135 # active connections.
136 #
137 export IFCONFIG='
138 <window title="Network status" icon-name="network-wire">
139 <vbox>
140 <text wrap="false">
141 <input>date</input>
142 </text>
143 <notebook labels="Network interfaces'
144 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG|Wireless interfaces|Wireless networks"
145 tmp='|Routing|Servers">
146 <frame Ifconfig>
147 <text wrap="false" width-chars="58">
148 <input>ifconfig</input>
149 </text>
150 </frame>'
151 IFCONFIG="$IFCONFIG$tmp"
152 tmp='<frame Iwconfig>
153 <text wrap="false" width-chars="58">
154 <input>iwconfig</input>
155 </text>
156 </frame>
157 <frame Wireless networks>
158 <text wrap="false" width-chars="58">
159 <input>iwlist scan</input>
160 </text>
161 </frame>'
162 [ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG$tmp"
163 tmp='<frame Routing>
164 <frame Nameservers>
165 <text wrap="false" width-chars="58">
166 <input>cat /etc/resolv.conf</input>
167 </text>
168 </frame>
169 <frame Routing table>
170 <text wrap="false" width-chars="58">
171 <input>route</input>
172 </text>
173 </frame>
174 <frame Arp table>
175 <text wrap="false" width-chars="58">
176 <input>arp</input>
177 </text>
178 </frame>
179 </frame>
180 <frame Servers>
181 <text wrap="false" width-chars="58">
182 <input>for i in dropbear inetd udhcpd dnsd rsync lighttpd smbd nmbd x11vnc pppd; do ps ww | grep $i | grep -v grep | fold -s; done</input>
183 </text>
184 </frame>
185 </notebook>
186 <hbox>
187 <button>
188 <input file icon="gtk-close"></input>
189 <action type="closewindow">IFCONFIG</action>
190 </button>
191 </hbox>
192 </vbox>
193 </window>
194 '
195 IFCONFIG="$IFCONFIG$tmp"
197 # The main dialog with notebook, start/stop buttons and all options.
198 # Note than /etc/network.conf is seded wehwn an interafce is activate
199 #
200 NET_BOX='
201 <window title="SliTaz Netbox Manager" icon-name="network-wired">
202 <vbox>
204 <hbox>
205 <text use-markup="true">
206 <label>"<b>Network/Server Manager</b>"</label>
207 </text>
208 <pixmap>
209 <input file>/usr/share/pixmaps/netbox.png</input>
210 </pixmap>
211 </hbox>
213 <frame General>
214 <hbox>
215 <text use-markup="true">
216 <label>"<b>Interface :</b>"</label>
217 </text>
218 <combobox>
219 <variable>INTERFACE</variable>'
220 . /etc/network.conf
221 NET_BOX="$NET_BOX<item>$INTERFACE</item>$(
222 grep : /proc/net/dev | cut -d: -f1 | while read dev; do
223 [ "$(echo $dev)" = "$INTERFACE" ] && continue
224 echo "<item>$dev</item>"
225 done)"
226 tmp=' </combobox>
227 </hbox>
228 </frame>
230 <notebook labels="DHCP|PPPoE|PPP|Static IP'
231 NET_BOX="$NET_BOX$tmp"
232 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX|Wifi"
233 NET_BOX="$NET_BOX|System wide|VPN|Servers"
234 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall"
235 tmp='|Etherwake">
237 <frame Udhcpc>
238 <hbox>
239 <text use-markup="true">
240 <label>"<b>Options :</b>"</label>
241 </text>
242 <entry>
243 <default>-b</default>
244 <variable>UDHCPC_OPTS</variable>
245 </entry>
246 <button>
247 <input file icon="help"></input>
248 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x27 -title "udhcpc help" -e "udhcpc --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
249 </button>
250 </hbox>
251 <hbox>
252 <button>
253 <label>Start</label>
254 <input file icon="forward"></input>
255 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
256 <action>sed -i s/DHCP=\"no\"/DHCP=\"yes\"/ /etc/network.conf</action>
257 <action>sed -i s/STATIC=\"yes\"/STATIC=\"no\"/ /etc/network.conf</action>
258 <action>udhcpc $UDHCPC_OPTS -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid</action>
259 </button>
260 <button>
261 <label>Stop</label>
262 <input file icon="stop"></input>
263 <action>echo -n "Stopping interface : $INTERFACE... "</action>
264 <action>ifconfig $INTERFACE down</action>
265 <action>killall -q udhcpc; echo "done"</action>
266 </button>
267 </hbox>
268 </frame>
270 <frame PPPoE>
271 <hbox>
272 <text use-markup="true">
273 <label>"<b>Name :</b>"</label>
274 </text>
275 <entry>
276 <input>NAME=$(grep -s ^name /etc/ppp/options); echo "${NAME#* }"</input>
277 <variable>NAME</variable>
278 </entry>
279 </hbox>
280 <hbox>
281 <text use-markup="true">
282 <label>"<b>Username :</b>"</label>
283 </text>
284 <entry>
285 <variable>USER</variable>
286 </entry>
287 </hbox>
288 <hbox>
289 <text use-markup="true">
290 <label>"<b>Password :</b>"</label>
291 </text>
292 <entry>
293 <variable>PASS</variable>
294 </entry>
295 </hbox>
296 <hbox>
297 <button>
298 <input file icon="help"></input>
299 <label>Help</label>
300 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "pppd help (q to quit)" -e "pppd --help 2>&1 | less"</action>
301 </button>
302 <button>
303 <input file icon="accessories-text-editor"></input>
304 <label>Tune</label>
305 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
306 <action type="lauch">leafpad /etc/ppp/options</action>
307 </button>
308 <button>
309 <label>Start</label>
310 <input file icon="forward"></input>
311 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
312 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
313 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
314 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
315 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
316 <action>killall udhcpc</action>
317 <action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
318 <action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
319 <action>pppd $INTERFACE &</action>
320 </button>
321 <button>
322 <label>Stop</label>
323 <input file icon="stop"></input>
324 <action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
325 <action>killall pppd</action>
326 </button>
327 </hbox>
328 </frame>
330 <frame PPP>
331 <hbox>
332 <text use-markup="true">
333 <label>"<b>Username :</b>"</label>
334 </text>
335 <entry>
336 <input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
337 <variable>USER</variable>
338 </entry>
339 </hbox>
340 <hbox>
341 <text use-markup="true">
342 <label>"<b>Password :</b>"</label>
343 </text>
344 <entry>
345 <input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
346 <variable>PASS</variable>
347 </entry>
348 </hbox>
349 <hbox>
350 <text use-markup="true">
351 <label>"<b>Telephone:</b>"</label>
352 </text>
353 <entry>
354 <input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
355 <variable>PHONE</variable>
356 </entry>
357 </hbox>
358 <hbox>
359 <button>
360 <input file icon="help"></input>
361 <label>Help</label>
362 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "pppd help (q to quit)" -e "pppd --help 2>&1 | less"</action>
363 </button>
364 <button>
365 <input file icon="accessories-text-editor"></input>
366 <label>Tune</label>
367 <action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=$NAME/" /etc/ppp/scripts/ppp-on</action>
368 <action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=$PASS/" /etc/ppp/scripts/ppp-on</action>
369 <action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=$PHONE/" /etc/ppp/scripts/ppp-on</action>
370 <action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
371 </button>
372 <button>
373 <label>Start</label>
374 <input file icon="forward"></input>
375 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
376 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
377 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
378 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
379 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
380 <action>/etc/ppp/scripts/ppp-off</action>
381 <action>/etc/ppp/scripts/ppp-on &</action>
382 </button>
383 <button>
384 <label>Stop</label>
385 <input file icon="stop"></input>
386 <action>/etc/ppp/scripts/ppp-off</action>
387 </button>
388 </hbox>
389 </frame>
391 <frame Configuration>
392 <hbox>
393 <text use-markup="true">
394 <label>"<b>IP :</b>"</label>
395 </text>
396 <entry>
397 <input>. /etc/network.conf; echo "$IP"</input>
398 <variable>IP</variable>
399 </entry>
400 </hbox>
401 <hbox>
402 <text use-markup="true">
403 <label>"<b>Netmask :</b>"</label>
404 </text>
405 <entry>
406 <input>. /etc/network.conf; echo "$NETMASK"</input>
407 <variable>NETMASK</variable>
408 </entry>
409 </hbox>
410 <hbox>
411 <text use-markup="true">
412 <label>"<b>Gateway :</b>"</label>
413 </text>
414 <entry>
415 <input>. /etc/network.conf; echo "$GATEWAY"</input>
416 <variable>GATEWAY</variable>
417 </entry>
418 </hbox>
419 <hbox>
420 <text use-markup="true">
421 <label>"<b>DNS server :</b>"</label>
422 </text>
423 <entry>
424 <input>. /etc/network.conf; echo "$DNS_SERVER"</input>
425 <variable>DNS_SERVER</variable>
426 </entry>
427 </hbox>
428 <hbox>
429 <button>
430 <label>Start</label>
431 <input file icon="forward"></input>
432 <action>ifconfig lo down</action>
433 <action>ifconfig $INTERFACE down</action>
434 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
435 <action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
436 <action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
437 <action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
438 <action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
439 <action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
440 <action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
441 <action>/etc/init.d/network.sh</action>
442 </button>
443 <button>
444 <label>Stop</label>
445 <input file icon="stop"></input>
446 <action>echo -n "Stopping interface : $INTERFACE... "</action>
447 <action>ifconfig $INTERFACE down; echo "done"</action>
448 </button>
449 </hbox>
450 </frame>'
451 NET_BOX="$NET_BOX$tmp"
452 tmp='<frame Wireless>
453 <notebook labels="Interface|Extra parameters|WPA'
454 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp|Kernel Modules"
455 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp|Ndiswrapper"
456 tmp2='">
457 <vbox>
458 <hbox>
459 <text use-markup="true">
460 <label>"<b>Interface :</b>"</label>
461 </text>
462 <entry>
463 <input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
464 <variable>WIFI_INTERFACE</variable>
465 </entry>
466 <text use-markup="true">
467 <label>"<b>ESSID :</b>"</label>
468 </text>
469 <combobox>'
470 . /etc/network.conf
471 tmp2="$tmp2<item>$WIFI_ESSID</item>$ESSIDS"
472 tmp3='</combobox>
473 </hbox>
474 </vbox>
475 <vbox>
476 <hbox>
477 <text use-markup="true">
478 <label>"<b>Channel :</b>"</label>
479 </text>
480 <entry>
481 <input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
482 <variable>WIFI_CHANNEL</variable>
483 </entry>
484 <text use-markup="true">
485 <label>"<b>Mode :</b>"</label>
486 </text>
487 <combobox>
488 <variable>WIFI_MODE</variable>'
489 tmp2="$tmp2$tmp3<item>$WIFI_MODE</item>"
490 for i in managed ad-hoc master repeater secondary monitor; do
491 [ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
492 done
493 tmp3='</combobox>
494 </hbox>
495 <hbox>
496 <text use-markup="true">
497 <label>"<b>Key :</b>"</label>
498 </text>
499 <entry>
500 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
501 <variable>WIFI_KEY</variable>
502 </entry>
503 </hbox>
504 </vbox>'
505 tmp="$tmp$tmp2$tmp3"
506 tmp2='<vbox>
507 <hbox>
508 <text use-markup="true">
509 <label>"<b>WPA_OPTIONS</b>"</label>
510 </text>
511 <entry editable="false">'
512 [ -n "$WPA_OPTIONS" ] && tmp2="$tmp2<default>$WPA_OPTIONS</default>"
513 tmp3='
514 <variable>WPA_OPTS</variable>
515 </entry>
516 <button>
517 <input file icon="help"></input>
518 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "wpa_supplicant help (q to quit)" -e "wpa_supplicant --help | less"</action>
519 </button>
520 <button>
521 <input file icon="accessories-text-editor"></input>
522 <action type="lauch">leafpad /etc/daemons.conf</action>
523 </button>
524 </hbox>
525 <hbox>
526 <text use-markup="true">
527 <label>"<b>Configuration:</b>"</label>
528 </text>
529 <entry editable="false">
530 <default>/etc/wpa_supplicant.conf</default>
531 <variable>WPA_CONF</variable>
532 </entry>
533 <button>
534 <input file icon="accessories-text-editor"></input>
535 <action type="lauch">leafpad $WPA_CONF</action>
536 </button>
537 </hbox>
538 <hbox>
539 <button>
540 <label>Start WPA</label>
541 <input file icon="forward"></input>
542 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)wpa_supplicant \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
543 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"wpa_supplicant \1\"/" /etc/rcS.conf</action>
544 <action>/etc/init.d/wpa_supplicant start</action>
545 </button>
546 <button>
547 <label>Stop WPA</label>
548 <input file icon="stop"></input>
549 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)wpa_supplicant \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
550 <action>/etc/init.d/wpa_supplicant stop</action>
551 </button>
552 </hbox>
553 </vbox>'
554 [ -x /usr/bin/wpa_supplicant ] && tmp="$tmp$tmp2$tmp3"
555 tmp2='<vbox>
556 <hbox>
557 <text wrap="true" width-chars="64" use-markup="true">
558 <label>
559 "<i>The package <b>wpa_supplicant</b> is not yet installed</i>"
560 </label>
561 </text>
562 <button>
563 <input file icon="go-jump"></input>
564 <label>Install</label>
565 <action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
566 <action>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>
567 <action type="exit">Exit</action>
568 </button>
569 </hbox>
570 </vbox>'
571 [ -x /usr/bin/wpa_supplicant ] || tmp="$tmp$tmp2"
572 tmp2='<vbox>
573 <hbox>
574 <button>
575 <label>Load</label>
576 <input file icon="forward"></input>
577 <action>modprobe $MODULE</action>
578 </button>
579 <button>
580 <label>Unload</label>
581 <input file icon="forward"></input>
582 <action>modprobe -r $MODULE</action>
583 </button>
584 <text use-markup="true">
585 <label>"<b>Wifi Module :</b>"</label>
586 </text>
587 <combobox>
588 <variable>MODULE</variable>'
589 tmp2="$tmp2$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f | sed 's,/.*/\(.*\).ko.gz,<item>\1</item>,')"
590 tmp3='</combobox>
591 <button>
592 <label>Lsmod</label>
593 <input file icon="computer"></input>
594 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
595 </button>
596 </hbox>
597 </vbox>'
598 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp$tmp2$tmp3"
599 tmp2='<vbox>
600 <hbox>
601 <text use-markup="true">
602 <label>"<b>Drivers :</b>"</label>
603 </text>
604 <entry>
605 <input>. /etc/network.conf; echo "$NDISWRAPPER_DRIVERS"</input>
606 <variable>NDISWRAPPER_DRIVERS</variable>
607 </entry>
608 <button>
609 <label>Restart</label>
610 <input file icon="reload"></input>
611 <action>rmmod ndiswrapper</action>
612 <action>for i in $NDISWRAPPER_DRIVERS; do ndiswrapper -i $i; done</action>
613 <action>modprobe ndiswrapper</action>
614 </button>
615 </hbox>
616 </vbox>'
617 [ -x /usr/sbin/ndiswrapper ] && tmp="$tmp$tmp2"
618 tmp2='</notebook>
619 <hbox>
620 <button>
621 <label>Start</label>
622 <input file icon="forward"></input>
623 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_INTERFACE=`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
624 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_ESSID=`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
625 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_KEY=`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
626 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_MODE=`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
627 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_CHANNEL=`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
628 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
629 <action>ifconfig $WIFI_INTERFACE down</action>
630 <action>/etc/init.d/network.sh</action>
631 </button>
632 <button>
633 <label>Stop</label>
634 <input file icon="stop"></input>
635 <action>ifconfig $WIFI_INTERFACE down</action>
636 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
637 </button>
638 </hbox>
639 </frame>'
640 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX$tmp$tmp2"
641 tmp='<frame Configuration files>
642 <hbox>
643 <text use-markup="true">
644 <label>"<b>Hosts :</b>"</label>
645 </text>
646 <entry editable="false">
647 <default>/etc/hosts</default>
648 <variable>HOSTS</variable>
649 </entry>
650 <button>
651 <input file icon="accessories-text-editor"></input>
652 <action type="lauch">leafpad $HOSTS</action>
653 </button>
654 </hbox>
655 <hbox>
656 <text use-markup="true">
657 <label>"<b>Host name :</b>"</label>
658 </text>
659 <entry editable="false">
660 <default>/etc/hostname</default>
661 <variable>HOSTNAME</variable>
662 </entry>
663 <button>
664 <input file icon="accessories-text-editor"></input>
665 <action type="lauch">leafpad $HOSTNAME</action>
666 </button>
667 </hbox>
668 <hbox>
669 <text use-markup="true">
670 <label>"<b>Network :</b>"</label>
671 </text>
672 <entry editable="false">
673 <default>/etc/network.conf</default>
674 <variable>CONFIG_FILE</variable>
675 </entry>
676 <button>
677 <input file icon="accessories-text-editor"></input>
678 <action type="lauch">leafpad $CONFIG_FILE</action>
679 </button>
680 </hbox>
681 <hbox>
682 <button>
683 <label>Restart</label>
684 <input file icon="reload"></input>
685 <action>echo -n "Stopping interface : $INTERFACE... "</action>
686 <action>ifconfig lo down</action>
687 <action>ifconfig $INTERFACE down</action>
688 <action>killall -q udhcpc; echo "done"</action>
689 <action>/etc/init.d/network.sh</action>
690 </button>
691 </hbox>
692 </frame>
694 <frame Virtual Private Network with PPP/SSH>
695 <hbox>
696 <text use-markup="true">
697 <label>"<b>Peer :</b>"</label>
698 </text>
699 <entry>
700 <variable>DROPBEAR_PEERVPN</variable>
701 <default>user@elsewhere</default>
702 </entry>
703 </hbox>
704 <hbox>
705 <text use-markup="true">
706 <label>"<b>Local IP :</b>"</label>
707 </text>
708 <entry>
709 <variable>DROPBEAR_LOCAL</variable>
710 <default>192.168.254.1</default>
711 </entry>
712 </hbox>
713 <hbox>
714 <text use-markup="true">
715 <label>"<b>Remote IP :</b>"</label>
716 </text>
717 <entry>
718 <variable>DROPBEAR_REMOTE</variable>
719 <default>192.168.254.2</default>
720 </entry>
721 </hbox>
722 <hbox>
723 <text use-markup="true">
724 <label>"<b>Route(s) :</b>"</label>
725 </text>
726 <entry>
727 <variable>DROPBEAR_ROUTE</variable>
728 <default>192.168.10.0/24 192.168.20.0/28</default>
729 </entry>
730 </hbox>
731 <hbox>
732 <button>
733 <input file icon="forward"></input>
734 <label>Connect</label>
735 <action>netbox call vpnssh $DROPBEAR_PEERVPN $DROPBEAR_LOCAL $DROPBEAR_REMOTE "$DROPBEAR_ROUTE" &</action>
736 </button>
737 <button>
738 <input file icon="stop"></input>
739 <label>Disconnect</label>
740 <action>netbox call killvpnssh</action>
741 </button>
742 <button>
743 <input file icon="go-up"></input>
744 <label>Send key</label>
745 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x10 -title "dropbear help" -e "netbox call sendsshkey $DROPBEAR_PEERVPN; echo -e \"----\nENTER to continue...\" && read close"</action>
746 </button>
747 </hbox>
748 </frame>
749 <notebook labels="'
750 NET_BOX="$NET_BOX$tmp"
751 tmp=''
752 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}SSH" && tmp='|'
753 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}INETD" && tmp='|'
754 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}${tmp}ZEROCONF" && tmp='|'
755 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}${tmp}DHCP" && tmp='|'
756 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
757 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] \
758 && NET_BOX="${NET_BOX}${tmp}PXE" && tmp='|'
759 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}DNS" && tmp='|'
760 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|'
761 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP" && tmp='|'
762 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|'
763 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}VNC" && tmp='|'
764 . /etc/daemons.conf
765 set -- $DROPBEAR_OPTIONS
766 while [ -n "$2" ]; do
767 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
768 shift
769 done
770 NET_BOX="${NET_BOX}\">"
771 tmp='<frame Dropbear>
772 <hbox>
773 <text use-markup="true">
774 <label>"<b>DROPBEAR_OPTIONS</b>"</label>
775 </text>
776 <entry editable="false">'
777 [ -n "$DROPBEAR_OPTIONS" ] && tmp="$tmp<default>$DROPBEAR_OPTIONS</default>"
778 tmp2='
779 <variable>DROPBEAR_OPTS</variable>
780 </entry>
781 <button>
782 <input file icon="help"></input>
783 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "dropbear help" -e "dropbear --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
784 </button>
785 <button>
786 <input file icon="accessories-text-editor"></input>
787 <action type="lauch">leafpad /etc/daemons.conf</action>
788 </button>
789 </hbox>
790 <hbox>
791 <text use-markup="true">
792 <label>"<b>Banner :</b>"</label>
793 </text>
794 <entry editable="false">'
795 [ -n "$DROPBEAR_BANNER" ] && tmp="$tmp$tmp2<default>$DROPBEAR_BANNER</default>"
796 tmp2='
797 <variable>DROPBEAR_BANNER</variable>
798 </entry>
799 <button>
800 <input file icon="accessories-text-editor"></input>
801 <action type="lauch">leafpad $DROPBEAR_BANNER</action>
802 </button>
803 </hbox>
804 <hbox>
805 <text use-markup="true">
806 <label>"<b>Remote :</b>"</label>
807 </text>
808 <entry>
809 <variable>DROPBEAR_PEER</variable>
810 <default>user@elsewhere</default>
811 </entry>
812 <button>
813 <input file icon="utilities-terminal"></input>
814 <label>Connect</label>
815 <action>xterm -fa MiscFixed -fs 11 -bg black -fg white -geometry 80x25 -title "$DROPBEAR_PEER" -e "dbclient -i /etc/dropbear/dropbear_rsa_host_key $DROPBEAR_PEER ; echo -e \"----\nENTER to continue...\" && read close" &</action>
816 </button>
817 <button>
818 <input file icon="go-up"></input>
819 <label>Send key</label>
820 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x10 -title "dropbear help" -e "netbox call sendsshkey $DROPBEAR_PEER; echo -e \"----\nENTER to continue...\" && read close"</action>
821 </button>
822 </hbox>
823 <hbox>
824 <button>
825 <label>Start</label>
826 <input file icon="forward"></input>
827 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
828 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dropbear \1\"/" /etc/rcS.conf</action>
829 <action>/etc/init.d/dropbear start</action>
830 </button>
831 <button>
832 <label>Stop</label>
833 <input file icon="stop"></input>
834 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
835 <action>/etc/init.d/dropbear stop</action>
836 </button>
837 </hbox>
838 </frame>
839 '
840 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
841 tmp='<frame Inetd>
842 <hbox>
843 <text use-markup="true">
844 <label>"<b>INETD_OPTIONS</b>"</label>
845 </text>
846 <entry editable="false">'
847 [ -n "$INETD_OPTS" ] && tmp="$tmp<default>$INETD_OPTS</default>"
848 tmp2='
849 <variable>INETD_OPTS</variable>
850 </entry>
851 <button>
852 <input file icon="help"></input>
853 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x14 -title "inetd help" -e "inetd --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
854 </button>
855 <button>
856 <input file icon="accessories-text-editor"></input>
857 <action type="lauch">leafpad /etc/daemons.conf</action>
858 </button>
859 </hbox>
860 <hbox>
861 <text use-markup="true">
862 <label>"<b>Configuration :</b>"</label>
863 </text>
864 <entry editable="false">
865 <default>/etc/inetd.conf</default>
866 <variable>INETD_CONF</variable>
867 </entry>
868 <button>
869 <input file icon="accessories-text-editor"></input>
870 <action type="lauch">leafpad $INETD_CONF</action>
871 </button>
872 </hbox>
873 <hbox>
874 '
875 tmp="$tmp$tmp2"
876 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
877 i=$(basename $i)
878 tmp2="
879 <button>
880 <input file icon=\"help\"></input>
881 <label>$i</label>
882 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x19 -title \"$i help\" -e \"$i --help ; echo -e \\\"----\nENTER to continue...\\\" && read close\"</action>
883 </button>
884 "
885 tmp="$tmp$tmp2"
886 done
887 tmp2='
888 <button>
889 <label>Start</label>
890 <input file icon="forward"></input>
891 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
892 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"inetd \1\"/" /etc/rcS.conf</action>
893 <action>/etc/init.d/inetd start</action>
894 </button>
895 <button>
896 <label>Stop</label>
897 <input file icon="stop"></input>
898 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
899 <action>/etc/init.d/inetd stop</action>
900 </button>
901 </hbox>
902 </frame>
903 '
904 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
905 if [ -x /sbin/zcip -a -z "$ZCIP_OPTS" ]; then
906 ZCIP_OPTS="eth0 /etc/zcip.script"
907 cat >> /etc/daemons.conf <<EOT
908 # ZeroConf options
909 ZCIP_OPTS="$ZCIP_OPTS"
911 EOT
912 fi
913 tmp='<frame Zcip>
914 <hbox>
915 <text use-markup="true">
916 <label>"<b>ZCIP_OPTIONS</b>"</label>
917 </text>
918 <entry editable="false">'
919 [ -n "$ZCIP_OPTS" ] && tmp="$tmp<default>$ZCIP_OPTS</default>"
920 tmp2='
921 <variable>CZIP_OPTS</variable>
922 </entry>
923 <button>
924 <input file icon="help"></input>
925 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x14 -title "zcip help" -e "zcip --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
926 </button>
927 <button>
928 <input file icon="accessories-text-editor"></input>
929 <action type="lauch">leafpad /etc/daemons.conf</action>
930 </button>
931 </hbox>
932 <hbox>
933 <text use-markup="true">
934 <label>"<b>Script :</b>"</label>
935 </text>
936 <entry editable="false">
937 <default>/etc/zcip.script</default>
938 <variable>CZIP_SCRIPT</variable>
939 </entry>
940 <button>
941 <input file icon="accessories-text-editor"></input>
942 <action type="lauch">leafpad $CZIP_SCRIPT</action>
943 </button>
944 </hbox>
945 <hbox>
946 <button>
947 <label>Start</label>
948 <input file icon="forward"></input>
949 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
950 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"zcip \1\"/" /etc/rcS.conf</action>
951 <action>/etc/init.d/zcip start</action>
952 </button>
953 <button>
954 <label>Stop</label>
955 <input file icon="stop"></input>
956 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
957 <action>/etc/init.d/zcip stop</action>
958 </button>
959 </hbox>
960 </frame>
961 '
962 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}$tmp$tmp2"
963 tmp='<frame Dhcpd>
964 <hbox>
965 <text use-markup="true">
966 <label>"<b>UDHCPD_OPTIONS</b>"</label>
967 </text>
968 <entry editable="false">'
969 [ -n "$UDHCPD_OPTS" ] && tmp="$tmp<default>$UDHCPD_OPTS</default>"
970 tmp2='
971 <variable>UDHCPD_OPTS</variable>
972 </entry>
973 <button>
974 <input file icon="help"></input>
975 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 60x14 -title "udhcpd help" -e "udhcpd --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
976 </button>
977 <button>
978 <input file icon="accessories-text-editor"></input>
979 <action type="lauch">leafpad /etc/daemons.conf</action>
980 </button>
981 </hbox>
982 <hbox>
983 <text use-markup="true">
984 <label>"<b>Configuration :</b>"</label>
985 </text>
986 <entry editable="false">
987 <default>/etc/udhcpd.conf</default>
988 <variable>UDHCPD_CONF</variable>
989 </entry>
990 <button>
991 <input file icon="accessories-text-editor"></input>
992 <action type="lauch">leafpad $UDHCPD_CONF</action>
993 </button>
994 </hbox>
995 <hbox>
996 <text use-markup="true">
997 <label>"<b>Script :</b>"</label>
998 </text>
999 <entry editable="false">
1000 <default>/usr/share/udhcpc/default.script</default>
1001 <variable>UDHCPD_SCRIPT</variable>
1002 </entry>
1003 <button>
1004 <input file icon="accessories-text-editor"></input>
1005 <action type="lauch">leafpad $UDHCPD_SCRIPT</action>
1006 </button>
1007 </hbox>
1008 <hbox>
1009 <button>
1010 <label>Start</label>
1011 <input file icon="forward"></input>
1012 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1013 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"udhcpd \1\"/" /etc/rcS.conf</action>
1014 <action>/etc/init.d/udhcpd start</action>
1015 </button>
1016 <button>
1017 <label>Stop</label>
1018 <input file icon="stop"></input>
1019 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1020 <action>/etc/init.d/udhcpd stop</action>
1021 </button>
1022 </hbox>
1023 </frame>
1025 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}$tmp$tmp2"
1026 tmp='<frame Pxelinux>
1027 <hbox>
1028 <text wrap="true">
1029 <label>
1030 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
1031 </label>
1032 </text>
1033 </hbox>
1034 <hbox>
1035 <text use-markup="true">
1036 <label>"<b>Configuration :</b>"</label>
1037 </text>
1038 <entry editable="false">
1039 <default>'
1040 tmp="$tmp$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')"
1041 tmp2='/pxelinux.cfg/default</default>
1042 <variable>PXE_CONF</variable>
1043 </entry>
1044 <button>
1045 <input file icon="accessories-text-editor"></input>
1046 <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
1047 <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
1048 <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
1049 <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> $UDHCPD_CONF</action>
1050 <action>[ -f $PXE_CONF ] || echo -e "label linux\n\tkernel bzImage\n\tappend initrd=rootfs.gz rw root=/dev/null vga=normal" > $PXE_CONF</action>
1051 <action type="lauch">leafpad $PXE_CONF</action>
1052 </button>
1053 </hbox>
1054 <hbox>
1055 <button>
1056 <input file icon="system-file-manager"></input>
1057 <label>Network boot files</label>
1058 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 100x25 -title "Network boot files (q to quit)" -e "find $(dirname $(dirname $PXE_CONF)) -exec ls -ld {} \; | less"</action>
1059 </button>
1060 </hbox>
1061 </frame>
1063 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
1064 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] && NET_BOX="$NET_BOX$tmp$tmp2"
1065 tmp='<frame Dnsd>
1066 <hbox>
1067 <text use-markup="true">
1068 <label>"<b>DNSD_OPTIONS</b>"</label>
1069 </text>
1070 <entry editable="false">'
1071 [ -n "$DNSD_OPTIONS" ] && tmp="$tmp<default>$DNSD_OPTIONS</default>"
1072 tmp2='
1073 <variable>DNSD_OPTS</variable>
1074 </entry>
1075 <button>
1076 <input file icon="help"></input>
1077 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x15 -title "dnsd help" -e "dnsd --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
1078 </button>
1079 <button>
1080 <input file icon="accessories-text-editor"></input>
1081 <action type="lauch">leafpad /etc/daemons.conf</action>
1082 </button>
1083 </hbox>
1084 <hbox>
1085 <text use-markup="true">
1086 <label>"<b>Configuration :</b>"</label>
1087 </text>
1088 <entry editable="false">
1089 <default>/etc/dnsd.conf</default>
1090 <variable>DNSD_CONF</variable>
1091 </entry>
1092 <button>
1093 <input file icon="accessories-text-editor"></input>
1094 <action type="lauch">leafpad $DNSD_CONF</action>
1095 </button>
1096 </hbox>
1097 <hbox>
1098 <button>
1099 <label>Start</label>
1100 <input file icon="forward"></input>
1101 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1102 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dnsd \1\"/" /etc/rcS.conf</action>
1103 <action>/etc/init.d/dnsd start</action>
1104 </button>
1105 <button>
1106 <label>Stop</label>
1107 <input file icon="stop"></input>
1108 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1109 <action>/etc/init.d/dnsd stop</action>
1110 </button>
1111 </hbox>
1112 </frame>
1114 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1115 tmp='<frame Rsync>
1116 <hbox>
1117 <text use-markup="true">
1118 <label>"<b>RSYNCD_OPTIONS</b>"</label>
1119 </text>
1120 <entry editable="false">'
1121 [ -n "${RSYNCD_OPTIONS#* }" ] && tmp="$tmp<default>${RSYNCD_OPTIONS#* }</default>"
1122 tmp2='
1123 <variable>RSYNC_OPTS</variable>
1124 </entry>
1125 <button>
1126 <input file icon="help"></input>
1127 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x31 -title "rsync daemon help" -e "rsync --daemon --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
1128 </button>
1129 <button>
1130 <input file icon="accessories-text-editor"></input>
1131 <action type="lauch">leafpad /etc/daemons.conf</action>
1132 </button>
1133 </hbox>
1134 <hbox>
1135 <text use-markup="true">
1136 <label>"<b>Configuration :</b>"</label>
1137 </text>
1138 <entry editable="false">
1139 <default>/etc/rsyncd.conf</default>
1140 <variable>RSYNCD_CONF</variable>
1141 </entry>
1142 <button>
1143 <input file icon="accessories-text-editor"></input>
1144 <action type="lauch">leafpad $RSYNCD_CONF</action>
1145 </button>
1146 </hbox>
1147 <hbox>
1148 <text use-markup="true">
1149 <label>"<b>Secrets file :</b>"</label>
1150 </text>
1151 <entry editable="true">
1152 <default>/etc/rsyncd.secrets</default>
1153 <variable>RSYNCD_SECRETS</variable>
1154 </entry>
1155 <button>
1156 <input file icon="accessories-text-editor"></input>
1157 <action type="lauch">leafpad $RSYNCD_SECRETS</action>
1158 </button>
1159 </hbox>
1160 <hbox>
1161 <button>
1162 <label>Start</label>
1163 <input file icon="forward"></input>
1164 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1165 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"rsyncd \1\"/" /etc/rcS.conf</action>
1166 <action>/etc/init.d/rsyncd start</action>
1167 </button>
1168 <button>
1169 <label>Stop</label>
1170 <input file icon="stop"></input>
1171 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1172 <action>/etc/init.d/rsyncd stop</action>
1173 </button>
1174 </hbox>
1175 </frame>
1177 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1178 tmp='<frame Lighttpd>'
1179 tmp2='<frame PHP>
1180 <hbox>
1181 <text use-markup="true">
1182 <label>"<b>Configuration :</b>"</label>
1183 </text>
1184 <entry editable="false">
1185 <default>/etc/php.ini</default>
1186 <variable>PHP_CONF</variable>
1187 </entry>
1188 <button>
1189 <input file icon="accessories-text-editor"></input>
1190 <action type="lauch">leafpad $PHP_CONF</action>
1191 </button>
1192 </hbox>
1193 </frame>
1195 [ -f /etc/php.ini ] && tmp="${tmp}${tmp2}"
1196 tmp2='<hbox>
1197 <text use-markup="true">
1198 <label>"<b>Configuration :</b>"</label>
1199 </text>
1200 <entry editable="false">
1201 <default>/etc/lighttpd/lighttpd.conf</default>
1202 <variable>LIGHTTPD_CONF</variable>
1203 </entry>
1204 <button>
1205 <input file icon="accessories-text-editor"></input>
1206 <action type="lauch">leafpad $LIGHTTPD_CONF</action>
1207 </button>
1208 </hbox>
1209 <hbox>
1210 <button>
1211 <label>Start</label>
1212 <input file icon="forward"></input>
1213 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1214 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"lighttpd \1\"/" /etc/rcS.conf</action>
1215 <action>/etc/init.d/lighttpd start</action>
1216 </button>
1217 <button>
1218 <label>Stop</label>
1219 <input file icon="stop"></input>
1220 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1221 <action>/etc/init.d/lighttpd stop</action>
1222 </button>
1223 </hbox>
1224 </frame>
1226 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1227 tmp='<frame Samba: smbd & nmbd>
1228 <hbox>
1229 <text use-markup="true">
1230 <label>"<b>Configuration :</b>"</label>
1231 </text>
1232 <entry editable="false">
1233 <default>/etc/samba/smb.conf</default>
1234 <variable>SMBD_CONF</variable>
1235 </entry>
1236 <button>
1237 <input file icon="accessories-text-editor"></input>
1238 <action type="lauch">leafpad $SMBD_CONF</action>
1239 </button>
1240 </hbox>
1241 <hbox>
1242 <button>
1243 <label>Reload</label>
1244 <input file icon="reload"></input>
1245 <action>/etc/init.d/samba reload</action>
1246 </button>
1247 <button>
1248 <label>Start</label>
1249 <input file icon="forward"></input>
1250 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1251 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
1252 <action>/etc/init.d/samba start</action>
1253 </button>
1254 <button>
1255 <label>Stop</label>
1256 <input file icon="stop"></input>
1257 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1258 <action>/etc/init.d/samba stop</action>
1259 </button>
1260 </hbox>
1261 </frame>
1263 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}"
1264 tmp='<frame x11vnc>
1265 <hbox>
1266 <text use-markup="true">
1267 <label>"<b>X11VNC_OPTIONS</b>"</label>
1268 </text>
1269 <entry editable="false">'
1270 [ -n "$X11VNC_OPTIONS" ] && tmp="$tmp<default>$X11VNC_OPTIONS</default>"
1271 tmp2='
1272 <variable>X11VNC_OPTS</variable>
1273 </entry>
1274 <button>
1275 <input file icon="help"></input>
1276 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "x11vnc daemon help (q to quit)" -e "x11vnc --help | less"</action>
1277 </button>
1278 <button>
1279 <input file icon="accessories-text-editor"></input>
1280 <action type="lauch">leafpad /etc/daemons.conf</action>
1281 </button>
1282 </hbox>
1283 <hbox>
1284 <text use-markup="true">
1285 <label>"<b>New password</b>"</label>
1286 </text>
1287 <entry>
1288 <variable>X11VNC_PASSWD</variable>
1289 </entry>
1290 <button>
1291 <input file icon="reload"></input>
1292 <label>Update</label>
1293 <action>x11vnc -storepasswd $X11VNC_PASSWD /etc/vnc.secret</action>
1294 </button>
1295 </hbox>
1296 <hbox>
1297 <button>
1298 <label>Start</label>
1299 <input file icon="forward"></input>
1300 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1301 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"x11vnc \1\"/" /etc/rcS.conf</action>
1302 <action>/etc/init.d/x11vnc start</action>
1303 </button>
1304 <button>
1305 <label>Stop</label>
1306 <input file icon="stop"></input>
1307 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1308 <action>/etc/init.d/x11vnc stop</action>
1309 </button>
1310 </hbox>
1311 </frame>
1313 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1314 NET_BOX="${NET_BOX}
1315 </notebook>
1317 tmp='<frame Iptables>
1318 <hbox>
1319 <text use-markup="true">
1320 <label>"<b>Configuration :</b>"</label>
1321 </text>
1322 <entry editable="false">
1323 <default>/etc/iptables.conf</default>
1324 <variable>IPTABLES_CONF</variable>
1325 </entry>
1326 <button>
1327 <input file icon="accessories-text-editor"></input>
1328 <action type="lauch">leafpad $IPTABLES_CONF</action>
1329 </button>
1330 </hbox>
1331 <hbox>
1332 <button>
1333 <label>Load</label>
1334 <input file icon="reload"></input>
1335 <action>cat $IPTABLES_CONF | /sbin/iptables-restore</action>
1336 </button>
1337 <button>
1338 <label>Save</label>
1339 <input file icon="go-jump"></input>
1340 <action>/sbin/iptables-save > $IPTABLES_CONF</action>
1341 </button>
1342 </hbox>
1343 </frame>
1345 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
1346 tmp='
1347 <frame Ether-wake>
1348 <hbox>
1349 <text use-markup="true">
1350 <label>"<b>Machines :</b>"</label>
1351 </text>
1352 <entry editable="false">
1353 <default>/etc/ethers</default>
1354 <variable>ETHERS</variable>
1355 </entry>
1356 <button>
1357 <input file icon="accessories-text-editor"></input>
1358 <action>[ -s $ETHERS ] || echo "#00:01:02:03:04:05 mystation" >$ETHERS</action>
1359 <action type="lauch">leafpad $ETHERS</action>
1360 </button>
1361 </hbox>
1362 <hbox>
1363 <text use-markup="true">
1364 <label>"<b>Options : </b>"</label>
1365 </text>
1366 <entry editable="false">
1367 <variable>ETHERWAKE_OPTS</variable>
1368 </entry>
1369 <button>
1370 <input file icon="help"></input>
1371 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x15 -title "dnsd help" -e "ether-wake --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
1372 </button>
1373 <button>
1374 <label>Start</label>
1375 <input file icon="forward"></input>
1376 <action>ether-wake $ETHERWAKE_OPTS</action>
1377 </button>
1378 </hbox>
1379 </frame>
1380 </notebook>
1382 <hbox>
1383 <button>
1384 <label>Status</label>
1385 <input file icon="dialog-information"></input>
1386 <action type="launch">IFCONFIG</action>
1387 </button>
1388 <button help>
1389 <label>Help</label>
1390 <action type="launch">HELP</action>
1391 </button>
1392 <button>
1393 <label>Quit</label>
1394 <input file icon="exit"></input>
1395 <action type="exit">Exit</action>
1396 </button>
1397 </hbox>
1399 </vbox>
1400 </window>
1402 NET_BOX="${NET_BOX}${tmp}"
1404 export NET_BOX
1406 # TODO: Modules(Network kernel modules) VPN(OpenVPN)
1408 # Only root can configure network.
1409 check_root
1410 # Configure and connect if button Connect was pressed.
1411 if ! grep -qs ^name /etc/ppp/options ; then
1412 # Generate /etc/ppp/options
1413 cat > /etc/ppp/options << _EOT_
1414 plugin rp-pppoe.so
1415 name provider-ID
1416 noipdefault
1417 defaultroute
1418 mtu 1492
1419 mru 1492
1420 lock
1421 _EOT_
1422 # Generate /etc/ppp/pap-secrets
1423 cat > /etc/ppp/pap-secrets << _EOT_
1424 # Secrets for authentication using PAP
1425 # client server secret IP addresses
1426 _EOT_
1427 # Generate /etc/ppp/chap-secrets
1428 cat > /etc/ppp/chap-secrets << _EOT_
1429 # Secrets for authentication using CHAP
1430 # client server secret IP addresses
1431 _EOT_
1432 fi
1433 gtkdialog --center --program=NET_BOX
1435 exit 0