slitaz-tools view tinyutils/netbox @ rev 258

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