slitaz-tools view tinyutils/netbox @ rev 227

netbox: add WIFI_IWCONFIG_ARGS var
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 11 09:58:18 2008 +0000 (2008-07-11)
parents 803ff10f67b2
children 5c0f59e46c0e
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 <text use-markup="true">
253 <label>"<b>Script :</b>"</label>
254 </text>
255 <entry editable="false">
256 <default>/usr/share/udhcpc/default.script</default>
257 <variable>UDHCPC_SCRIPT</variable>
258 </entry>
259 <button>
260 <input file icon="accessories-text-editor"></input>
261 <action type="lauch">leafpad $UDHCPC_SCRIPT</action>
262 </button>
263 </hbox>
264 <hbox>
265 <button>
266 <label>Start</label>
267 <input file icon="forward"></input>
268 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
269 <action>sed -i s/DHCP=\"no\"/DHCP=\"yes\"/ /etc/network.conf</action>
270 <action>sed -i s/STATIC=\"yes\"/STATIC=\"no\"/ /etc/network.conf</action>
271 <action>udhcpc $UDHCPC_OPTS -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid</action>
272 </button>
273 <button>
274 <label>Stop</label>
275 <input file icon="stop"></input>
276 <action>echo -n "Stopping interface : $INTERFACE... "</action>
277 <action>ifconfig $INTERFACE down</action>
278 <action>killall -q udhcpc; echo "done"</action>
279 </button>
280 </hbox>
281 </frame>
283 <frame PPPoE>
284 <hbox>
285 <text use-markup="true">
286 <label>"<b>Name :</b>"</label>
287 </text>
288 <entry>
289 <input>NAME=$(grep -s ^name /etc/ppp/options); echo "${NAME#* }"</input>
290 <variable>NAME</variable>
291 </entry>
292 </hbox>
293 <hbox>
294 <text use-markup="true">
295 <label>"<b>Username :</b>"</label>
296 </text>
297 <entry>
298 <variable>USER</variable>
299 </entry>
300 </hbox>
301 <hbox>
302 <text use-markup="true">
303 <label>"<b>Password :</b>"</label>
304 </text>
305 <entry>
306 <variable>PASS</variable>
307 </entry>
308 </hbox>
309 <hbox>
310 <button>
311 <input file icon="help"></input>
312 <label>Help</label>
313 <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>
314 </button>
315 <button>
316 <input file icon="accessories-text-editor"></input>
317 <label>Tune</label>
318 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
319 <action type="lauch">leafpad /etc/ppp/options</action>
320 </button>
321 <button>
322 <label>Start</label>
323 <input file icon="forward"></input>
324 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
325 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
326 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
327 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
328 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
329 <action>killall udhcpc</action>
330 <action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
331 <action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
332 <action>pppd $INTERFACE &</action>
333 </button>
334 <button>
335 <label>Stop</label>
336 <input file icon="stop"></input>
337 <action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
338 <action>killall pppd</action>
339 </button>
340 </hbox>
341 </frame>
343 <frame PPP>
344 <hbox>
345 <text use-markup="true">
346 <label>"<b>Username :</b>"</label>
347 </text>
348 <entry>
349 <input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
350 <variable>USER</variable>
351 </entry>
352 </hbox>
353 <hbox>
354 <text use-markup="true">
355 <label>"<b>Password :</b>"</label>
356 </text>
357 <entry>
358 <input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
359 <variable>PASS</variable>
360 </entry>
361 </hbox>
362 <hbox>
363 <text use-markup="true">
364 <label>"<b>Telephone:</b>"</label>
365 </text>
366 <entry>
367 <input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
368 <variable>PHONE</variable>
369 </entry>
370 </hbox>
371 <hbox>
372 <button>
373 <input file icon="help"></input>
374 <label>Help</label>
375 <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>
376 </button>
377 <button>
378 <input file icon="accessories-text-editor"></input>
379 <label>Tune</label>
380 <action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=$NAME/" /etc/ppp/scripts/ppp-on</action>
381 <action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=$PASS/" /etc/ppp/scripts/ppp-on</action>
382 <action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=$PHONE/" /etc/ppp/scripts/ppp-on</action>
383 <action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
384 </button>
385 <button>
386 <label>Start</label>
387 <input file icon="forward"></input>
388 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
389 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/pap-secrets</action>
390 <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
391 && echo "\"$USER\" * \"$PASS\"" >> /etc/ppp/chap-secrets</action>
392 <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
393 <action>/etc/ppp/scripts/ppp-off</action>
394 <action>/etc/ppp/scripts/ppp-on &</action>
395 </button>
396 <button>
397 <label>Stop</label>
398 <input file icon="stop"></input>
399 <action>/etc/ppp/scripts/ppp-off</action>
400 </button>
401 </hbox>
402 </frame>
404 <frame Configuration>
405 <hbox>
406 <text use-markup="true">
407 <label>"<b>IP :</b>"</label>
408 </text>
409 <entry>
410 <input>. /etc/network.conf; echo "$IP"</input>
411 <variable>IP</variable>
412 </entry>
413 </hbox>
414 <hbox>
415 <text use-markup="true">
416 <label>"<b>Netmask :</b>"</label>
417 </text>
418 <entry>
419 <input>. /etc/network.conf; echo "$NETMASK"</input>
420 <variable>NETMASK</variable>
421 </entry>
422 </hbox>
423 <hbox>
424 <text use-markup="true">
425 <label>"<b>Gateway :</b>"</label>
426 </text>
427 <entry>
428 <input>. /etc/network.conf; echo "$GATEWAY"</input>
429 <variable>GATEWAY</variable>
430 </entry>
431 </hbox>
432 <hbox>
433 <text use-markup="true">
434 <label>"<b>DNS server :</b>"</label>
435 </text>
436 <entry>
437 <input>. /etc/network.conf; echo "$DNS_SERVER"</input>
438 <variable>DNS_SERVER</variable>
439 </entry>
440 </hbox>
441 <hbox>
442 <button>
443 <label>Start</label>
444 <input file icon="forward"></input>
445 <action>ifconfig lo down</action>
446 <action>ifconfig $INTERFACE down</action>
447 <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
448 <action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
449 <action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
450 <action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
451 <action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
452 <action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
453 <action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
454 <action>/etc/init.d/network.sh</action>
455 </button>
456 <button>
457 <label>Stop</label>
458 <input file icon="stop"></input>
459 <action>echo -n "Stopping interface : $INTERFACE... "</action>
460 <action>ifconfig $INTERFACE down; echo "done"</action>
461 </button>
462 </hbox>
463 </frame>'
464 NET_BOX="$NET_BOX$tmp"
465 tmp='<frame Wireless>
466 <notebook labels="Interface|Extra parameters'
467 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp|Kernel Modules"
468 tmp2='">
469 <vbox>
470 <hbox>
471 <text use-markup="true">
472 <label>"<b>Interface :</b>"</label>
473 </text>
474 <entry>
475 <input>. /etc/network.conf; echo "$WIFI_INTERFACE"</input>
476 <variable>WIFI_INTERFACE</variable>
477 </entry>
478 <text use-markup="true">
479 <label>"<b>ESSID :</b>"</label>
480 </text>
481 <combobox>'
482 . /etc/network.conf
483 tmp2="$tmp2<item>$WIFI_ESSID</item>$ESSIDS"
484 tmp3='</combobox>
485 </hbox>
486 <hbox>
487 <text use-markup="true">
488 <label>"<b>Key :</b>"</label>
489 </text>
490 <entry>
491 <input>. /etc/network.conf; echo "$WIFI_KEY"</input>
492 <variable>WIFI_KEY</variable>
493 </entry>
494 <combobox>
495 <item>none</item>
496 <item>WEP</item>
497 <item>WPA</item>
498 <item>any</item>
499 <variable>WIFI_KEY_TYPE</variable>
500 </combobox>
501 </hbox>
502 </vbox>
503 <vbox>
504 <hbox>
505 <text use-markup="true">
506 <label>"<b>Channel :</b>"</label>
507 </text>
508 <entry>
509 <input>. /etc/network.conf; echo "$WIFI_CHANNEL"</input>
510 <variable>WIFI_CHANNEL</variable>
511 </entry>
512 <text use-markup="true">
513 <label>"<b>Mode :</b>"</label>
514 </text>
515 <combobox>
516 <variable>WIFI_MODE</variable>'
517 tmp2="$tmp2$tmp3<item>$WIFI_MODE</item>"
518 for i in managed ad-hoc master repeater secondary monitor; do
519 [ "$i" = "$WIFI_MODE" ] || tmp2="$tmp2<item>$i</item>"
520 done
521 tmp3='</combobox>
522 </hbox>
523 <hbox>
524 <text use-markup="true">
525 <label>"<b>Other iwconfig args :</b>"</label>
526 </text>
527 <entry>
528 <input>. /etc/network.conf; echo "$WIFI_IWCONFIG_ARGS"</input>
529 <variable>WIFI_IWCONFIG_ARGS</variable>
530 </entry>
531 <button>
532 <input file icon="help"></input>
533 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "iwconfig help" -e "iwconfig --help ; echo -e \"----\nENTER to continue...\" && read close"</action>
534 </button>
535 <button>
536 <input file icon="help"></input>
537 <label>Web</label>
538 <action>firefox http://www.linuxmanpages.com/man8/iwconfig.8.php</action>
539 </button>
540 </hbox>
541 </vbox>'
542 tmp="$tmp$tmp2$tmp3"
543 tmp2='<vbox>
544 <hbox>
545 <button>
546 <label>Load</label>
547 <input file icon="forward"></input>
548 <action>modprobe $MODULE</action>
549 </button>
550 <button>
551 <label>Unload</label>
552 <input file icon="forward"></input>
553 <action>modprobe -r $MODULE</action>
554 </button>
555 <text use-markup="true">
556 <label>"<b>Wifi Module :</b>"</label>
557 </text>
558 <combobox>
559 <variable>MODULE</variable>'
560 tmp2="$tmp2$(find /lib/modules/$(uname -r)/kernel/drivers/net/wireless -type f | sed 's,/.*/\(.*\).ko.gz,<item>\1</item>,')"
561 tmp3='</combobox>
562 <button>
563 <label>Lsmod</label>
564 <input file icon="computer"></input>
565 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x25 -title "Modules (q to quit)" -e "lsmod | less"</action>
566 </button>
567 </hbox>'
568 tmp2="$tmp2$tmp3"
569 tmp3=$(for i in /usr/bin/get*firmware; do [ -x $i ] || continue; [ -d /var/lib/tazpkg/installed/${i#/usr/bin/get-} ] && continue; echo "<item>${i#/usr/bin/get-}</item>"; done)
570 [ -n "$tmp3" ] && tmp3="
571 <hbox>
572 <text use-markup=\"true\">
573 <label>\"<b>Firmware :</b>\"</label>
574 </text>
575 <combobox><variable>FIRMWARE</variable>$tmp3</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 </button>
581 <button>
582 <input file icon=\"system-file-manager\"></input>
583 <label>Firmware files</label>
584 <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>
585 </button>
586 </hbox>
587 "
588 tmp2="$tmp2$tmp3"
589 tmp3=""
590 [ -x /usr/sbin/ndiswrapper ] && tmp3='
591 <hbox>
592 <text use-markup="true">
593 <label>"<b>Ndiswrapper drivers :</b>"</label>
594 </text>
595 <entry>
596 <input>. /etc/network.conf; echo "$NDISWRAPPER_DRIVERS"</input>
597 <variable>NDISWRAPPER_DRIVERS</variable>
598 </entry>
599 <button>
600 <label>Restart</label>
601 <input file icon="reload"></input>
602 <action>rmmod ndiswrapper</action>
603 <action>for i in $NDISWRAPPER_DRIVERS; do ndiswrapper -i $i; done</action>
604 <action>modprobe ndiswrapper</action>
605 </button>
606 </hbox>
607 '
608 tmp3="$tmp3</vbox>"
609 [ -d /lib/modules/`uname -r`/kernel/drivers/net/wireless ] && tmp="$tmp$tmp2$tmp3"
610 tmp2='</notebook>
611 <hbox>
612 <button>
613 <label>Start</label>
614 <input file icon="forward"></input>
615 <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>
616 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_INTERFACE=`/WIFI_INTERFACE=\"$WIFI_INTERFACE\"/ /etc/network.conf</action>
617 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_ESSID=`/WIFI_ESSID=\"$WIFI_ESSID\"/ /etc/network.conf</action>
618 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_KEY=`/WIFI_KEY=\"$WIFI_KEY\"/ /etc/network.conf</action>
619 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_KEY_TYPE=`/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/ /etc/network.conf</action>
620 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_MODE=`/WIFI_MODE=\"$WIFI_MODE\"/ /etc/network.conf</action>
621 <action>sed -i s/`cat /etc/network.conf | grep ^WIFI_CHANNEL=`/WIFI_CHANNEL=\"$WIFI_CHANNEL\"/ /etc/network.conf</action>
622 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
623 <action>ifconfig $WIFI_INTERFACE down</action>
624 <action>iwconfig $WIFI_INTERFACE txpower auto</action>
625 <action>/etc/init.d/network.sh</action>
626 </button>
627 <button>
628 <label>Stop</label>
629 <input file icon="stop"></input>
630 <action>[ -x /etc/init.d/wpa_supplicant ] && /etc/init.d/wpa_supplicant stop</action>
631 <action>ifconfig $WIFI_INTERFACE down</action>
632 <action>iwconfig $WIFI_INTERFACE txpower off</action>
633 <action>[ -s /var/run/udhcpc.$WIFI_INTERFACE.pid ] && kill `cat /var/run/udhcpc.$WIFI_INTERFACE.pid`</action>
634 </button>
635 </hbox>
636 </frame>'
637 [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX$tmp$tmp2"
638 tmp='<frame Configuration files>
639 <hbox>
640 <text use-markup="true">
641 <label>"<b>Hosts :</b>"</label>
642 </text>
643 <entry editable="false">
644 <default>/etc/hosts</default>
645 <variable>HOSTS</variable>
646 </entry>
647 <button>
648 <input file icon="accessories-text-editor"></input>
649 <action type="lauch">leafpad $HOSTS</action>
650 </button>
651 </hbox>
652 <hbox>
653 <text use-markup="true">
654 <label>"<b>Host name :</b>"</label>
655 </text>
656 <entry editable="false">
657 <default>/etc/hostname</default>
658 <variable>HOSTNAME</variable>
659 </entry>
660 <button>
661 <input file icon="accessories-text-editor"></input>
662 <action type="lauch">leafpad $HOSTNAME</action>
663 </button>
664 </hbox>
665 <hbox>
666 <text use-markup="true">
667 <label>"<b>Network :</b>"</label>
668 </text>
669 <entry editable="false">
670 <default>/etc/network.conf</default>
671 <variable>CONFIG_FILE</variable>
672 </entry>
673 <button>
674 <input file icon="accessories-text-editor"></input>
675 <action type="lauch">leafpad $CONFIG_FILE</action>
676 </button>
677 </hbox>
678 <hbox>
679 <button>
680 <label>Restart</label>
681 <input file icon="reload"></input>
682 <action>echo -n "Stopping interface : $INTERFACE... "</action>
683 <action>ifconfig lo down</action>
684 <action>ifconfig $INTERFACE down</action>
685 <action>killall -q udhcpc; echo "done"</action>
686 <action>/etc/init.d/network.sh</action>
687 </button>
688 </hbox>
689 </frame>
691 <frame Virtual Private Network with PPP/SSH>
692 <hbox>
693 <text use-markup="true">
694 <label>"<b>Peer :</b>"</label>
695 </text>
696 <entry>
697 <variable>DROPBEAR_PEERVPN</variable>
698 <default>user@elsewhere</default>
699 </entry>
700 </hbox>
701 <hbox>
702 <text use-markup="true">
703 <label>"<b>Local IP :</b>"</label>
704 </text>
705 <entry>
706 <variable>DROPBEAR_LOCAL</variable>
707 <default>192.168.254.1</default>
708 </entry>
709 </hbox>
710 <hbox>
711 <text use-markup="true">
712 <label>"<b>Remote IP :</b>"</label>
713 </text>
714 <entry>
715 <variable>DROPBEAR_REMOTE</variable>
716 <default>192.168.254.2</default>
717 </entry>
718 </hbox>
719 <hbox>
720 <text use-markup="true">
721 <label>"<b>Route(s) :</b>"</label>
722 </text>
723 <entry>
724 <variable>DROPBEAR_ROUTE</variable>
725 <default>192.168.10.0/24 192.168.20.0/28</default>
726 </entry>
727 </hbox>
728 <hbox>
729 <button>
730 <input file icon="forward"></input>
731 <label>Connect</label>
732 <action>netbox call vpnssh $DROPBEAR_PEERVPN $DROPBEAR_LOCAL $DROPBEAR_REMOTE "$DROPBEAR_ROUTE" &</action>
733 </button>
734 <button>
735 <input file icon="stop"></input>
736 <label>Disconnect</label>
737 <action>netbox call killvpnssh</action>
738 </button>
739 <button>
740 <input file icon="go-up"></input>
741 <label>Send key</label>
742 <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>
743 </button>
744 </hbox>
745 </frame>
746 <notebook labels="'
747 NET_BOX="$NET_BOX$tmp"
748 tmp=''
749 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}SSH" && tmp='|'
750 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}INETD" && tmp='|'
751 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}${tmp}ZEROCONF" && tmp='|'
752 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}${tmp}DHCP" && tmp='|'
753 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
754 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] \
755 && NET_BOX="${NET_BOX}${tmp}PXE" && tmp='|'
756 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}DNS" && tmp='|'
757 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|'
758 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP" && tmp='|'
759 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|'
760 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}VNC" && tmp='|'
761 . /etc/daemons.conf
762 set -- $DROPBEAR_OPTIONS
763 while [ -n "$2" ]; do
764 [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
765 shift
766 done
767 NET_BOX="${NET_BOX}\">"
768 tmp='<frame Dropbear>
769 <hbox>
770 <text use-markup="true">
771 <label>"<b>DROPBEAR_OPTIONS</b>"</label>
772 </text>
773 <entry editable="false">'
774 [ -n "$DROPBEAR_OPTIONS" ] && tmp="$tmp<default>$DROPBEAR_OPTIONS</default>"
775 tmp2='
776 <variable>DROPBEAR_OPTS</variable>
777 </entry>
778 <button>
779 <input file icon="help"></input>
780 <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>
781 </button>
782 <button>
783 <input file icon="accessories-text-editor"></input>
784 <action type="lauch">leafpad /etc/daemons.conf</action>
785 </button>
786 </hbox>
787 <hbox>
788 <text use-markup="true">
789 <label>"<b>Banner :</b>"</label>
790 </text>
791 <entry editable="false">'
792 [ -n "$DROPBEAR_BANNER" ] && tmp="$tmp$tmp2<default>$DROPBEAR_BANNER</default>"
793 tmp2='
794 <variable>DROPBEAR_BANNER</variable>
795 </entry>
796 <button>
797 <input file icon="accessories-text-editor"></input>
798 <action type="lauch">leafpad $DROPBEAR_BANNER</action>
799 </button>
800 </hbox>
801 <hbox>
802 <text use-markup="true">
803 <label>"<b>Remote :</b>"</label>
804 </text>
805 <entry>
806 <variable>DROPBEAR_PEER</variable>
807 <default>user@elsewhere</default>
808 </entry>
809 <button>
810 <input file icon="utilities-terminal"></input>
811 <label>Connect</label>
812 <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>
813 </button>
814 <button>
815 <input file icon="go-up"></input>
816 <label>Send key</label>
817 <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>
818 </button>
819 </hbox>
820 <hbox>
821 <button>
822 <label>Start</label>
823 <input file icon="forward"></input>
824 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
825 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dropbear \1\"/" /etc/rcS.conf</action>
826 <action>/etc/init.d/dropbear start</action>
827 </button>
828 <button>
829 <label>Stop</label>
830 <input file icon="stop"></input>
831 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dropbear \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
832 <action>/etc/init.d/dropbear stop</action>
833 </button>
834 </hbox>
835 </frame>
836 '
837 [ -x /usr/sbin/dropbear ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
838 tmp='<frame Inetd>
839 <hbox>
840 <text use-markup="true">
841 <label>"<b>INETD_OPTIONS</b>"</label>
842 </text>
843 <entry editable="false">'
844 [ -n "$INETD_OPTS" ] && tmp="$tmp<default>$INETD_OPTS</default>"
845 tmp2='
846 <variable>INETD_OPTS</variable>
847 </entry>
848 <button>
849 <input file icon="help"></input>
850 <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>
851 </button>
852 <button>
853 <input file icon="accessories-text-editor"></input>
854 <action type="lauch">leafpad /etc/daemons.conf</action>
855 </button>
856 </hbox>
857 <hbox>
858 <text use-markup="true">
859 <label>"<b>Configuration :</b>"</label>
860 </text>
861 <entry editable="false">
862 <default>/etc/inetd.conf</default>
863 <variable>INETD_CONF</variable>
864 </entry>
865 <button>
866 <input file icon="accessories-text-editor"></input>
867 <action type="lauch">leafpad $INETD_CONF</action>
868 </button>
869 </hbox>
870 <hbox>
871 '
872 tmp="$tmp$tmp2"
873 for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
874 i=$(basename $i)
875 tmp2="
876 <button>
877 <input file icon=\"help\"></input>
878 <label>$i</label>
879 <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>
880 </button>
881 "
882 tmp="$tmp$tmp2"
883 done
884 tmp2='
885 <button>
886 <label>Start</label>
887 <input file icon="forward"></input>
888 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
889 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"inetd \1\"/" /etc/rcS.conf</action>
890 <action>/etc/init.d/inetd start</action>
891 </button>
892 <button>
893 <label>Stop</label>
894 <input file icon="stop"></input>
895 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)inetd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
896 <action>/etc/init.d/inetd stop</action>
897 </button>
898 </hbox>
899 </frame>
900 '
901 [ -x /usr/sbin/inetd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
902 if [ -x /sbin/zcip -a -z "$ZCIP_OPTS" ]; then
903 ZCIP_OPTS="eth0 /etc/zcip.script"
904 cat >> /etc/daemons.conf <<EOT
905 # ZeroConf options
906 ZCIP_OPTS="$ZCIP_OPTS"
908 EOT
909 fi
910 tmp='<frame Zcip>
911 <hbox>
912 <text use-markup="true">
913 <label>"<b>ZCIP_OPTIONS</b>"</label>
914 </text>
915 <entry editable="false">'
916 [ -n "$ZCIP_OPTS" ] && tmp="$tmp<default>$ZCIP_OPTS</default>"
917 tmp2='
918 <variable>CZIP_OPTS</variable>
919 </entry>
920 <button>
921 <input file icon="help"></input>
922 <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>
923 </button>
924 <button>
925 <input file icon="accessories-text-editor"></input>
926 <action type="lauch">leafpad /etc/daemons.conf</action>
927 </button>
928 </hbox>
929 <hbox>
930 <text use-markup="true">
931 <label>"<b>Script :</b>"</label>
932 </text>
933 <entry editable="false">
934 <default>/etc/zcip.script</default>
935 <variable>CZIP_SCRIPT</variable>
936 </entry>
937 <button>
938 <input file icon="accessories-text-editor"></input>
939 <action type="lauch">leafpad $CZIP_SCRIPT</action>
940 </button>
941 </hbox>
942 <hbox>
943 <button>
944 <label>Start</label>
945 <input file icon="forward"></input>
946 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
947 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"zcip \1\"/" /etc/rcS.conf</action>
948 <action>/etc/init.d/zcip start</action>
949 </button>
950 <button>
951 <label>Stop</label>
952 <input file icon="stop"></input>
953 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)zcip \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
954 <action>/etc/init.d/zcip stop</action>
955 </button>
956 </hbox>
957 </frame>
958 '
959 [ -x /sbin/zcip ] && NET_BOX="${NET_BOX}$tmp$tmp2"
960 tmp='<frame Dhcpd>
961 <hbox>
962 <text use-markup="true">
963 <label>"<b>UDHCPD_OPTIONS</b>"</label>
964 </text>
965 <entry editable="false">'
966 [ -n "$UDHCPD_OPTS" ] && tmp="$tmp<default>$UDHCPD_OPTS</default>"
967 tmp2='
968 <variable>UDHCPD_OPTS</variable>
969 </entry>
970 <button>
971 <input file icon="help"></input>
972 <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>
973 </button>
974 <button>
975 <input file icon="accessories-text-editor"></input>
976 <action type="lauch">leafpad /etc/daemons.conf</action>
977 </button>
978 </hbox>
979 <hbox>
980 <text use-markup="true">
981 <label>"<b>Configuration :</b>"</label>
982 </text>
983 <entry editable="false">
984 <default>/etc/udhcpd.conf</default>
985 <variable>UDHCPD_CONF</variable>
986 </entry>
987 <button>
988 <input file icon="accessories-text-editor"></input>
989 <action type="lauch">leafpad $UDHCPD_CONF</action>
990 </button>
991 </hbox>
992 <hbox>
993 <button>
994 <label>Start</label>
995 <input file icon="forward"></input>
996 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
997 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"udhcpd \1\"/" /etc/rcS.conf</action>
998 <action>/etc/init.d/udhcpd start</action>
999 </button>
1000 <button>
1001 <label>Stop</label>
1002 <input file icon="stop"></input>
1003 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)udhcpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1004 <action>/etc/init.d/udhcpd stop</action>
1005 </button>
1006 </hbox>
1007 </frame>
1009 [ -x /usr/sbin/udhcpd ] && NET_BOX="${NET_BOX}$tmp$tmp2"
1010 tmp='<frame Pxelinux>
1011 <hbox>
1012 <text wrap="true">
1013 <label>
1014 "Launch Dhcpd and Inetd with Tftpd to start the PXE service."
1015 </label>
1016 </text>
1017 </hbox>
1018 <hbox>
1019 <text use-markup="true">
1020 <label>"<b>Configuration :</b>"</label>
1021 </text>
1022 <entry editable="false">
1023 <default>'
1024 tmp="$tmp$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')"
1025 tmp2='/pxelinux.cfg/default</default>
1026 <variable>PXE_CONF</variable>
1027 </entry>
1028 <button>
1029 <input file icon="accessories-text-editor"></input>
1030 <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
1031 <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
1032 <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
1033 <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\ -f1)" >> $UDHCPD_CONF</action>
1034 <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>
1035 <action type="lauch">leafpad $PXE_CONF</action>
1036 </button>
1037 </hbox>
1038 <hbox>
1039 <button>
1040 <input file icon="system-file-manager"></input>
1041 <label>Network boot files</label>
1042 <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>
1043 </button>
1044 </hbox>
1045 </frame>
1047 [ -f /usr/share/boot/pxelinux.0.lzma -a -x /usr/bin/tftpd -a \
1048 -x /usr/sbin/inetd -a -x /usr/sbin/udhcpd ] && NET_BOX="$NET_BOX$tmp$tmp2"
1049 tmp='<frame Dnsd>
1050 <hbox>
1051 <text use-markup="true">
1052 <label>"<b>DNSD_OPTIONS</b>"</label>
1053 </text>
1054 <entry editable="false">'
1055 [ -n "$DNSD_OPTIONS" ] && tmp="$tmp<default>$DNSD_OPTIONS</default>"
1056 tmp2='
1057 <variable>DNSD_OPTS</variable>
1058 </entry>
1059 <button>
1060 <input file icon="help"></input>
1061 <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>
1062 </button>
1063 <button>
1064 <input file icon="accessories-text-editor"></input>
1065 <action type="lauch">leafpad /etc/daemons.conf</action>
1066 </button>
1067 </hbox>
1068 <hbox>
1069 <text use-markup="true">
1070 <label>"<b>Configuration :</b>"</label>
1071 </text>
1072 <entry editable="false">
1073 <default>/etc/dnsd.conf</default>
1074 <variable>DNSD_CONF</variable>
1075 </entry>
1076 <button>
1077 <input file icon="accessories-text-editor"></input>
1078 <action type="lauch">leafpad $DNSD_CONF</action>
1079 </button>
1080 </hbox>
1081 <hbox>
1082 <button>
1083 <label>Start</label>
1084 <input file icon="forward"></input>
1085 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1086 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"dnsd \1\"/" /etc/rcS.conf</action>
1087 <action>/etc/init.d/dnsd start</action>
1088 </button>
1089 <button>
1090 <label>Stop</label>
1091 <input file icon="stop"></input>
1092 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)dnsd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1093 <action>/etc/init.d/dnsd stop</action>
1094 </button>
1095 </hbox>
1096 </frame>
1098 [ -x /usr/sbin/dnsd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1099 tmp='<frame Rsync>
1100 <hbox>
1101 <text use-markup="true">
1102 <label>"<b>RSYNCD_OPTIONS</b>"</label>
1103 </text>
1104 <entry editable="false">'
1105 [ -n "${RSYNCD_OPTIONS#* }" ] && tmp="$tmp<default>${RSYNCD_OPTIONS#* }</default>"
1106 tmp2='
1107 <variable>RSYNC_OPTS</variable>
1108 </entry>
1109 <button>
1110 <input file icon="help"></input>
1111 <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>
1112 </button>
1113 <button>
1114 <input file icon="accessories-text-editor"></input>
1115 <action type="lauch">leafpad /etc/daemons.conf</action>
1116 </button>
1117 </hbox>
1118 <hbox>
1119 <text use-markup="true">
1120 <label>"<b>Configuration :</b>"</label>
1121 </text>
1122 <entry editable="false">
1123 <default>/etc/rsyncd.conf</default>
1124 <variable>RSYNCD_CONF</variable>
1125 </entry>
1126 <button>
1127 <input file icon="accessories-text-editor"></input>
1128 <action type="lauch">leafpad $RSYNCD_CONF</action>
1129 </button>
1130 </hbox>
1131 <hbox>
1132 <text use-markup="true">
1133 <label>"<b>Secrets file :</b>"</label>
1134 </text>
1135 <entry editable="true">
1136 <default>/etc/rsyncd.secrets</default>
1137 <variable>RSYNCD_SECRETS</variable>
1138 </entry>
1139 <button>
1140 <input file icon="accessories-text-editor"></input>
1141 <action type="lauch">leafpad $RSYNCD_SECRETS</action>
1142 </button>
1143 </hbox>
1144 <hbox>
1145 <button>
1146 <label>Start</label>
1147 <input file icon="forward"></input>
1148 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1149 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"rsyncd \1\"/" /etc/rcS.conf</action>
1150 <action>/etc/init.d/rsyncd start</action>
1151 </button>
1152 <button>
1153 <label>Stop</label>
1154 <input file icon="stop"></input>
1155 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)rsyncd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1156 <action>/etc/init.d/rsyncd stop</action>
1157 </button>
1158 </hbox>
1159 </frame>
1161 [ -x /usr/bin/rsync ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1162 tmp='<frame Lighttpd>'
1163 tmp2='<frame PHP>
1164 <hbox>
1165 <text use-markup="true">
1166 <label>"<b>Configuration :</b>"</label>
1167 </text>
1168 <entry editable="false">
1169 <default>/etc/php.ini</default>
1170 <variable>PHP_CONF</variable>
1171 </entry>
1172 <button>
1173 <input file icon="accessories-text-editor"></input>
1174 <action type="lauch">leafpad $PHP_CONF</action>
1175 </button>
1176 </hbox>
1177 </frame>
1179 [ -f /etc/php.ini ] && tmp="${tmp}${tmp2}"
1180 tmp2='<hbox>
1181 <text use-markup="true">
1182 <label>"<b>Configuration :</b>"</label>
1183 </text>
1184 <entry editable="false">
1185 <default>/etc/lighttpd/lighttpd.conf</default>
1186 <variable>LIGHTTPD_CONF</variable>
1187 </entry>
1188 <button>
1189 <input file icon="accessories-text-editor"></input>
1190 <action type="lauch">leafpad $LIGHTTPD_CONF</action>
1191 </button>
1192 </hbox>
1193 <hbox>
1194 <button>
1195 <label>Start</label>
1196 <input file icon="forward"></input>
1197 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1198 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"lighttpd \1\"/" /etc/rcS.conf</action>
1199 <action>/etc/init.d/lighttpd start</action>
1200 </button>
1201 <button>
1202 <label>Stop</label>
1203 <input file icon="stop"></input>
1204 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)lighttpd \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1205 <action>/etc/init.d/lighttpd stop</action>
1206 </button>
1207 </hbox>
1208 </frame>
1210 [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1211 tmp='<frame Samba: smbd & nmbd>
1212 <hbox>
1213 <text use-markup="true">
1214 <label>"<b>Configuration :</b>"</label>
1215 </text>
1216 <entry editable="false">
1217 <default>/etc/samba/smb.conf</default>
1218 <variable>SMBD_CONF</variable>
1219 </entry>
1220 <button>
1221 <input file icon="accessories-text-editor"></input>
1222 <action type="lauch">leafpad $SMBD_CONF</action>
1223 </button>
1224 </hbox>
1225 <hbox>
1226 <button>
1227 <label>Reload</label>
1228 <input file icon="reload"></input>
1229 <action>/etc/init.d/samba reload</action>
1230 </button>
1231 <button>
1232 <label>Start</label>
1233 <input file icon="forward"></input>
1234 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1235 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
1236 <action>/etc/init.d/samba start</action>
1237 </button>
1238 <button>
1239 <label>Stop</label>
1240 <input file icon="stop"></input>
1241 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1242 <action>/etc/init.d/samba stop</action>
1243 </button>
1244 </hbox>
1245 </frame>
1247 [ -x /usr/sbin/smbd ] && NET_BOX="${NET_BOX}${tmp}"
1248 tmp='<frame x11vnc>
1249 <hbox>
1250 <text use-markup="true">
1251 <label>"<b>X11VNC_OPTIONS</b>"</label>
1252 </text>
1253 <entry editable="false">'
1254 [ -n "$X11VNC_OPTIONS" ] && tmp="$tmp<default>$X11VNC_OPTIONS</default>"
1255 tmp2='
1256 <variable>X11VNC_OPTS</variable>
1257 </entry>
1258 <button>
1259 <input file icon="help"></input>
1260 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "x11vnc daemon help (q to quit)" -e "x11vnc --help | less"</action>
1261 </button>
1262 <button>
1263 <input file icon="accessories-text-editor"></input>
1264 <action type="lauch">leafpad /etc/daemons.conf</action>
1265 </button>
1266 </hbox>
1267 <hbox>
1268 <text use-markup="true">
1269 <label>"<b>New password</b>"</label>
1270 </text>
1271 <entry>
1272 <variable>X11VNC_PASSWD</variable>
1273 </entry>
1274 <button>
1275 <input file icon="reload"></input>
1276 <label>Update</label>
1277 <action>x11vnc -storepasswd $X11VNC_PASSWD /etc/vnc.secret</action>
1278 </button>
1279 </hbox>
1280 <hbox>
1281 <button>
1282 <label>Start</label>
1283 <input file icon="forward"></input>
1284 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1285 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"x11vnc \1\"/" /etc/rcS.conf</action>
1286 <action>/etc/init.d/x11vnc start</action>
1287 </button>
1288 <button>
1289 <label>Stop</label>
1290 <input file icon="stop"></input>
1291 <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
1292 <action>/etc/init.d/x11vnc stop</action>
1293 </button>
1294 </hbox>
1295 </frame>
1297 [ -x /usr/bin/x11vnc ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
1298 NET_BOX="${NET_BOX}
1299 </notebook>
1301 tmp='<frame Iptables>
1302 <hbox>
1303 <text use-markup="true">
1304 <label>"<b>Configuration :</b>"</label>
1305 </text>
1306 <entry editable="false">
1307 <default>/etc/iptables.conf</default>
1308 <variable>IPTABLES_CONF</variable>
1309 </entry>
1310 <button>
1311 <input file icon="accessories-text-editor"></input>
1312 <action type="lauch">leafpad $IPTABLES_CONF</action>
1313 </button>
1314 </hbox>
1315 <hbox>
1316 <button>
1317 <label>Load</label>
1318 <input file icon="reload"></input>
1319 <action>cat $IPTABLES_CONF | /sbin/iptables-restore</action>
1320 </button>
1321 <button>
1322 <label>Save</label>
1323 <input file icon="go-jump"></input>
1324 <action>/sbin/iptables-save > $IPTABLES_CONF</action>
1325 </button>
1326 </hbox>
1327 </frame>
1329 [ -x /sbin/iptables ] && NET_BOX="$NET_BOX${tmp}"
1330 tmp='
1331 <frame Ether-wake>
1332 <hbox>
1333 <text use-markup="true">
1334 <label>"<b>Machines :</b>"</label>
1335 </text>
1336 <entry editable="false">
1337 <default>/etc/ethers</default>
1338 <variable>ETHERS</variable>
1339 </entry>
1340 <button>
1341 <input file icon="accessories-text-editor"></input>
1342 <action>[ -s $ETHERS ] || echo "#00:01:02:03:04:05 mystation" >$ETHERS</action>
1343 <action type="lauch">leafpad $ETHERS</action>
1344 </button>
1345 </hbox>
1346 <hbox>
1347 <text use-markup="true">
1348 <label>"<b>Options : </b>"</label>
1349 </text>
1350 <entry editable="false">
1351 <variable>ETHERWAKE_OPTS</variable>
1352 </entry>
1353 <button>
1354 <input file icon="help"></input>
1355 <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>
1356 </button>
1357 <button>
1358 <label>Start</label>
1359 <input file icon="forward"></input>
1360 <action>ether-wake $ETHERWAKE_OPTS</action>
1361 </button>
1362 </hbox>
1363 </frame>
1364 </notebook>
1366 <hbox>
1367 <button>
1368 <label>Status</label>
1369 <input file icon="dialog-information"></input>
1370 <action type="launch">IFCONFIG</action>
1371 </button>
1372 <button help>
1373 <label>Help</label>
1374 <action type="launch">HELP</action>
1375 </button>
1376 <button>
1377 <label>Quit</label>
1378 <input file icon="exit"></input>
1379 <action type="exit">Exit</action>
1380 </button>
1381 </hbox>
1383 </vbox>
1384 </window>
1386 NET_BOX="${NET_BOX}${tmp}"
1388 export NET_BOX
1390 # TODO: Modules(Network kernel modules) VPN(OpenVPN)
1392 # Only root can configure network.
1393 check_root
1394 # Configure and connect if button Connect was pressed.
1395 if ! grep -qs ^name /etc/ppp/options ; then
1396 # Generate /etc/ppp/options
1397 cat > /etc/ppp/options << _EOT_
1398 plugin rp-pppoe.so
1399 name provider-ID
1400 noipdefault
1401 defaultroute
1402 mtu 1492
1403 mru 1492
1404 lock
1405 _EOT_
1406 # Generate /etc/ppp/pap-secrets
1407 cat > /etc/ppp/pap-secrets << _EOT_
1408 # Secrets for authentication using PAP
1409 # client server secret IP addresses
1410 _EOT_
1411 # Generate /etc/ppp/chap-secrets
1412 cat > /etc/ppp/chap-secrets << _EOT_
1413 # Secrets for authentication using CHAP
1414 # client server secret IP addresses
1415 _EOT_
1416 fi
1417 gtkdialog --center --program=NET_BOX
1419 exit 0