slitaz-tools rev 292

netbox: indent with tabs, add comments and separate frame
author Christophe Lincoln <pankso@slitaz.org>
date Sun Feb 15 00:06:44 2009 +0100 (2009-02-15)
parents b8a23fe2b8af
children 0ff827264caa
files tinyutils/netbox
line diff
     1.1 --- a/tinyutils/netbox	Sat Feb 14 23:20:24 2009 +0100
     1.2 +++ b/tinyutils/netbox	Sun Feb 15 00:06:44 2009 +0100
     1.3 @@ -1,9 +1,11 @@
     1.4  #!/bin/sh
     1.5  #
     1.6 -# Gtkdialog box to manage network connection.
     1.7 -# - SliTaz GNU/Linux 2008.
     1.8 +# Gtkdialog box to manage network connection and server.
     1.9 +# Please use tab to indent.
    1.10  #
    1.11 -VERSION=20081019
    1.12 +# (c) - SliTaz GNU/Linux 2009.
    1.13 +#
    1.14 +VERSION=20090214
    1.15  
    1.16  # Check if user is root.
    1.17  check_root()
    1.18 @@ -22,50 +24,50 @@
    1.19          label="<label>$3</label>"
    1.20  	[ -n "$3" ] || label=""
    1.21  	cat << EOT
    1.22 -      <button>
    1.23 -        <input file icon="help"></input>$label
    1.24 +<button>
    1.25 +	<input file icon="help"></input>$label
    1.26  	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry $2 -title "$1 help" -e "$(which $1) --help ; echo -e \\"----\\nENTER to continue...\\" && read close"</action>
    1.27 -      </button>
    1.28 +</button>
    1.29  EOT
    1.30  }
    1.31  
    1.32  editbutton()
    1.33  {
    1.34  	cat << EOT
    1.35 -        <button>
    1.36 -          <input file icon="accessories-text-editor"></input>
    1.37 -          <action type="lauch">leafpad $1</action>
    1.38 -        </button>
    1.39 +<button>
    1.40 +	<input file icon="accessories-text-editor"></input>
    1.41 +	<action type="lauch">leafpad $1</action>
    1.42 +</button>
    1.43  EOT
    1.44  }
    1.45  
    1.46  manbutton()
    1.47  {
    1.48  	cat << EOT
    1.49 -        <button>
    1.50 -          <input file icon="browser"></input>
    1.51 -	  <label>man</label>
    1.52 -	  <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
    1.53 -        </button>
    1.54 +<button>
    1.55 +	<input file icon="browser"></input>
    1.56 +	<label>man</label>
    1.57 +	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
    1.58 +</button>
    1.59  EOT
    1.60  }
    1.61  
    1.62  helpdaemon()
    1.63  {
    1.64  	cat << EOT
    1.65 -      <hbox>
    1.66 -        <text use-markup="true">
    1.67 -          <label>"<b>$3</b>"</label>
    1.68 -        </text>
    1.69 -        <entry editable="false">
    1.70 +<hbox>
    1.71 +	<text use-markup="true">
    1.72 +		<label>"<b>$3</b>"</label>
    1.73 +	</text>
    1.74 +	<entry editable="false">
    1.75  EOT
    1.76  	eval tmp=\$$3
    1.77  	[ -n "$tmp" ] && cat << EOT
    1.78 -	  <default>$tmp</default>
    1.79 +		<default>$tmp</default>
    1.80  EOT
    1.81  	cat << EOT
    1.82 -          <variable>$4</variable>
    1.83 -        </entry>
    1.84 +		<variable>$4</variable>
    1.85 +	</entry>
    1.86  EOT
    1.87  	[ -n "$6" ] || cat << EOT
    1.88  $(helpbutton $1 $2)
    1.89 @@ -75,32 +77,32 @@
    1.90  EOT
    1.91  	cat << EOT
    1.92  $(editbutton /etc/daemons.conf)
    1.93 -      </hbox>
    1.94 +</hbox>
    1.95  EOT
    1.96  }
    1.97  
    1.98  datafile()
    1.99  {
   1.100  	cat << EOT
   1.101 -      <hbox>
   1.102 -        <text use-markup="true">
   1.103 -          <label>"<b>$3</b>"</label>
   1.104 -        </text>
   1.105 -        <entry editable="false">
   1.106 +<hbox>
   1.107 +	<text use-markup="true">
   1.108 +		<label>"<b>$3</b>"</label>
   1.109 +	</text>
   1.110 + 	<entry editable="false">
   1.111  EOT
   1.112  	[ -n "$1" ] && cat << EOT
   1.113 -	  <default>$1</default>
   1.114 +		<default>$1</default>
   1.115  EOT
   1.116  	cat << EOT
   1.117 -          <variable>$2</variable>
   1.118 -        </entry>
   1.119 +		<variable>$2</variable>
   1.120 +	</entry>
   1.121  EOT
   1.122  	[ -n "$4" ] && cat << EOT
   1.123  $(manbutton $4)
   1.124  EOT
   1.125  	cat << EOT
   1.126  $(editbutton \$$2)
   1.127 -      </hbox>
   1.128 +</hbox>
   1.129  EOT
   1.130  }
   1.131  
   1.132 @@ -112,11 +114,11 @@
   1.133  webbutton()
   1.134  {
   1.135  	[ -f "/var/lib/tazpkg/installed/$1/receipt" ] && cat << EOT
   1.136 -        <button>
   1.137 -          <input file icon="browser"></input>
   1.138 -	  <label>web</label>
   1.139 -	  <action>. /var/lib/tazpkg/installed/$1/receipt ; firefox \$WEB_SITE &</action>
   1.140 -        </button>
   1.141 +<button>
   1.142 +	<input file icon="browser"></input>
   1.143 +	<label>web</label>
   1.144 +	<action>. /var/lib/tazpkg/installed/$1/receipt ; firefox \$WEB_SITE &</action>
   1.145 +</button>
   1.146  EOT
   1.147  }
   1.148  
   1.149 @@ -127,38 +129,36 @@
   1.150  	[ -n "$2" ] && pkg=$2
   1.151  	webbutton $pkg
   1.152  	cat << EOT
   1.153 -        <button>
   1.154 -          <label>Start</label>
   1.155 -          <input file icon="forward"></input>
   1.156 -          <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   1.157 -          <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"$1 \1\\"/" /etc/rcS.conf</action>
   1.158 -          <action>/etc/init.d/$1 start</action>
   1.159 -        </button>
   1.160 -        <button>
   1.161 -          <label>Stop</label>
   1.162 -          <input file icon="stop"></input>
   1.163 -          <action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   1.164 -          <action>/etc/init.d/$1 stop</action>
   1.165 -        </button>
   1.166 +<button>
   1.167 +	<label>Start</label>
   1.168 +	<input file icon="forward"></input>
   1.169 +	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   1.170 +	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"$1 \1\\"/" /etc/rcS.conf</action>
   1.171 +	<action>/etc/init.d/$1 start</action>
   1.172 +</button>
   1.173 +<button>
   1.174 +	<label>Stop</label>
   1.175 +	<input file icon="stop"></input>
   1.176 +	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   1.177 +	<action>/etc/init.d/$1 stop</action>
   1.178 +</button>
   1.179  EOT
   1.180  }
   1.181  
   1.182  installbox()
   1.183  {
   1.184  	cat << EOT
   1.185 -      <hbox>
   1.186 -      <text wrap="true" use-markup="true">
   1.187 -        <label>
   1.188 -"<i>The package <b>$1</b> is not yet installed</i>"
   1.189 -        </label>
   1.190 -      </text>
   1.191 -      <button>
   1.192 -        <input file icon="go-jump"></input>
   1.193 -	<label>Install</label>
   1.194 -	<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title "$1 install" -e "yes y | tazpkg get-install $1 ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
   1.195 -        <action type="exit">restart</action>
   1.196 -      </button>
   1.197 -      </hbox>
   1.198 +<hbox>
   1.199 +	<text wrap="true" use-markup="true">
   1.200 +		<label>"<i>The package <b>$1</b> is not yet installed</i>"</label>
   1.201 +	</text>
   1.202 +	<button>
   1.203 +		<input file icon="go-jump"></input>
   1.204 +		<label>Install</label>
   1.205 +		<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title "$1 install" -e "yes y | tazpkg get-install $1 ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
   1.206 +		<action type="exit">restart</action>
   1.207 +	</button>
   1.208 +</hbox>
   1.209  EOT
   1.210  }
   1.211  
   1.212 @@ -262,30 +262,31 @@
   1.213  export HELP='
   1.214  <window title="Network status" icon-name="network-wire">
   1.215  <vbox>
   1.216 -    <text use-markup="true">
   1.217 -    <label>"
   1.218 +	<text use-markup="true">
   1.219 +		<label>
   1.220 +"
   1.221  <b>SliTaz - Netbox</b>"
   1.222 -    </label>
   1.223 -  </text>
   1.224 -  <frame English>
   1.225 -    <text wrap="true" width-chars="58">
   1.226 -      <label>
   1.227 +		</label>
   1.228 +	</text>
   1.229 +	<frame English>
   1.230 +		<text wrap="true" width-chars="58">
   1.231 +			<label>
   1.232  "Netbox lets you manage network connections by getting dynamic IP by DHCP
   1.233  or static IP and setup servers. Netbox can start or stop networking,
   1.234  configure network interfaces or directly edit files."
   1.235 -      </label>
   1.236 -    </text>
   1.237 -  </frame>
   1.238 -  <frame Francais>
   1.239 -    <text wrap="true" width-chars="58">
   1.240 -      <label>
   1.241 +			</label>
   1.242 +		</text>
   1.243 +	</frame>
   1.244 +	<frame Francais>
   1.245 +		<text wrap="true" width-chars="58">
   1.246 +			<label>
   1.247  "Netbox vous permet de gerer les connexions reseau avec une IP
   1.248  statique ou en obtenant une IP dynamique par DHCP, et de parametrer
   1.249  les serveurs. Netbox peut demarrer ou arreter le reseau, configurer
   1.250  les interfaces reseau ou editer directement les fichiers."
   1.251 -      </label>
   1.252 -    </text>
   1.253 -  </frame>
   1.254 +			</label>
   1.255 +		</text>
   1.256 +	</frame>
   1.257  </vbox>
   1.258  </window>
   1.259  '
   1.260 @@ -295,62 +296,63 @@
   1.261  #
   1.262  export IFCONFIG='
   1.263  <window title="Network status" icon-name="network-wire">
   1.264 -  <vbox>
   1.265 -    <text wrap="false">
   1.266 -      <input>date</input>
   1.267 -    </text>
   1.268 -    <notebook labels="Network interfaces'
   1.269 -[ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG|Wireless interfaces|Wireless networks"
   1.270 -tmp='|Routing|Servers">
   1.271 -    <frame Ifconfig>
   1.272 -      <text wrap="false" width-chars="58">
   1.273 -        <input>ifconfig</input>
   1.274 -      </text>
   1.275 -    </frame>'
   1.276 -IFCONFIG="$IFCONFIG$tmp"
   1.277 -tmp='<frame Iwconfig>
   1.278 -      <text wrap="false" width-chars="58">
   1.279 -        <input>iwconfig</input>
   1.280 -      </text>
   1.281 -    </frame>
   1.282 -    <frame Wireless networks>
   1.283 -      <text wrap="false" width-chars="58">
   1.284 -        <input>iwlist scan</input>
   1.285 -      </text>
   1.286 -    </frame>'
   1.287 -[ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG$tmp"
   1.288 -tmp='<frame Routing>
   1.289 -    <frame Nameservers>
   1.290 -      <text wrap="false" width-chars="58">
   1.291 -        <input>cat /etc/resolv.conf</input>
   1.292 -      </text>
   1.293 -    </frame>
   1.294 -    <frame Routing table>
   1.295 -      <text wrap="false" width-chars="58">
   1.296 -        <input>route</input>
   1.297 -      </text>
   1.298 -    </frame>
   1.299 -    <frame Arp table>
   1.300 -      <text wrap="false" width-chars="58">
   1.301 -        <input>arp</input>
   1.302 -      </text>
   1.303 -    </frame>
   1.304 -    </frame>
   1.305 -    <frame Servers>
   1.306 -      <text wrap="false" width-chars="58">
   1.307 -        <input>for i in dropbear sshd inetd dhcpd dnsd named rsync httpd smbd nmbd x11vnc pppd knock; do ps ww | grep $i | grep -v grep | fold -s; done</input>
   1.308 -      </text>
   1.309 -    </frame>
   1.310 -    </notebook>
   1.311 -    <hbox>
   1.312 -      <button>
   1.313 -        <input file icon="gtk-close"></input>
   1.314 -        <action type="closewindow">IFCONFIG</action>
   1.315 -      </button>
   1.316 -    </hbox>
   1.317 -  </vbox>
   1.318 -</window>
   1.319 -'
   1.320 +<vbox>
   1.321 +	<text wrap="false">
   1.322 +		<input>date</input>
   1.323 +	</text>
   1.324 +	<notebook labels="Network interfaces'
   1.325 +		[ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG|Wireless interfaces|Wireless networks"
   1.326 +		tmp='|Routing|Servers">
   1.327 +		<frame Ifconfig>
   1.328 +			<text wrap="false" width-chars="58">
   1.329 +				<input>ifconfig</input>
   1.330 +			</text>
   1.331 +		</frame>'
   1.332 +		IFCONFIG="$IFCONFIG$tmp"
   1.333 +		tmp='
   1.334 +		<frame Iwconfig>
   1.335 +			<text wrap="false" width-chars="58">
   1.336 +				<input>iwconfig</input>
   1.337 +			</text>
   1.338 +		</frame>
   1.339 +		<frame Wireless networks>
   1.340 +			<text wrap="false" width-chars="58">
   1.341 +				<input>iwlist scan</input>
   1.342 +			</text>
   1.343 +		</frame>'
   1.344 +		[ -x /usr/sbin/iwlist ] && IFCONFIG="$IFCONFIG$tmp"
   1.345 +		tmp='
   1.346 +		<frame Routing>
   1.347 +			<frame Nameservers>
   1.348 +				<text wrap="false" width-chars="58">
   1.349 +					<input>cat /etc/resolv.conf</input>
   1.350 +				</text>
   1.351 +			</frame>
   1.352 +			<frame Routing table>
   1.353 +				<text wrap="false" width-chars="58">
   1.354 +					<input>route</input>
   1.355 +				</text>
   1.356 +			</frame>
   1.357 +			<frame Arp table>
   1.358 +				<text wrap="false" width-chars="58">
   1.359 +					<input>arp</input>
   1.360 +				</text>
   1.361 +			</frame>
   1.362 +		</frame>
   1.363 +		<frame Servers>
   1.364 +			<text wrap="false" width-chars="58">
   1.365 +				<input>for i in dropbear sshd inetd dhcpd dnsd named rsync httpd smbd nmbd x11vnc pppd knock; do ps ww | grep $i | grep -v grep | fold -s; done</input>
   1.366 +			</text>
   1.367 +		</frame>
   1.368 +	</notebook>
   1.369 +	<hbox>
   1.370 +		<button>
   1.371 +			<input file icon="gtk-close"></input>
   1.372 +			<action type="closewindow">IFCONFIG</action>
   1.373 +		</button>
   1.374 +	</hbox>
   1.375 +</vbox>
   1.376 +</window>'
   1.377  IFCONFIG="$IFCONFIG$tmp"
   1.378  
   1.379  # The main dialog with notebook, start/stop buttons and all options.
   1.380 @@ -358,9 +360,9 @@
   1.381  #
   1.382  NET_BOX='
   1.383  <window title="SliTaz Netbox Manager" icon-name="network-wired">
   1.384 -  <vbox>
   1.385 +<vbox>
   1.386  
   1.387 -    <hbox>
   1.388 +	<hbox>
   1.389  		<text use-markup="true">
   1.390  			<label>"<b>Network/Server Manager</b>"</label>
   1.391  		</text>
   1.392 @@ -369,271 +371,287 @@
   1.393  		</pixmap>
   1.394  	</hbox>'
   1.395  
   1.396 +# Notebook tabs.
   1.397  tmp='<notebook labels="DHCP|Static IP|PPPoE|PPP|Wifi|System wide|VPN|Servers'
   1.398  NET_BOX="$NET_BOX$tmp"
   1.399  [ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall"
   1.400  [ -x /usr/bin/knock ] && NET_BOX="$NET_BOX|Knock"
   1.401  tmp='|Etherwake">
   1.402  
   1.403 -    <frame Udhcpc (busybox)>
   1.404 -      <text width-chars="58">
   1.405 -          <label>
   1.406 +<frame Udhcpc (busybox)>
   1.407 +	<text width-chars="58">
   1.408 +		<label>
   1.409  "Ethernet (cable) default connexion.
   1.410  "
   1.411 -          </label>
   1.412 -       </text>
   1.413 -      <hbox>
   1.414 -        <text use-markup="true">
   1.415 -          <label>"<b>Interface:</b>"</label>
   1.416 -        </text>
   1.417 -        <entry>
   1.418 -          <input>. /etc/network.conf; echo "$INTERFACE"</input>
   1.419 -          <variable>INTERFACE</variable>
   1.420 -        </entry>
   1.421 -      </hbox>
   1.422 -      <hbox>
   1.423 -        <text use-markup="true">
   1.424 -          <label>"<b>Options:  </b>"</label>
   1.425 -        </text>
   1.426 -        <entry>
   1.427 -          <default>-b</default>
   1.428 -          <variable>UDHCPC_OPTS</variable>
   1.429 -        </entry>
   1.430 -        <button>
   1.431 -          <input file icon="help"></input>
   1.432 -	  <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>
   1.433 -        </button>
   1.434 -      </hbox>
   1.435 -      <hbox>
   1.436 -        <text use-markup="true">
   1.437 -          <label>"<b>Script:     </b>"</label>
   1.438 -        </text>
   1.439 -        <entry editable="false">
   1.440 -          <default>/usr/share/udhcpc/default.script</default>
   1.441 -          <variable>UDHCPC_SCRIPT</variable>
   1.442 -        </entry>
   1.443 -        <button>
   1.444 -          <input file icon="accessories-text-editor"></input>
   1.445 -          <action type="lauch">leafpad $UDHCPC_SCRIPT</action>
   1.446 -        </button>
   1.447 -      </hbox>
   1.448 -      <hbox>
   1.449 -        <button>
   1.450 -          <label>Start</label>
   1.451 -          <input file icon="forward"></input>
   1.452 -          <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
   1.453 -          <action>sed -i s/DHCP=\"no\"/DHCP=\"yes\"/ /etc/network.conf</action>
   1.454 -          <action>sed -i s/STATIC=\"yes\"/STATIC=\"no\"/ /etc/network.conf</action>
   1.455 -          <action>udhcpc $UDHCPC_OPTS -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid</action>
   1.456 -        </button>
   1.457 -        <button>
   1.458 -          <label>Stop</label>
   1.459 -          <input file icon="stop"></input>
   1.460 -          <action>echo -n "Stopping interface : $INTERFACE... "</action>
   1.461 -          <action>ifconfig $INTERFACE down</action>
   1.462 -          <action>killall -q udhcpc; echo "done"</action>
   1.463 -        </button>
   1.464 -      </hbox>
   1.465 -    </frame>
   1.466 -    
   1.467 -    <frame Ethernet fixed IP>
   1.468 -      <hbox>
   1.469 -        <text use-markup="true">
   1.470 -          <label>"<b>Interface:   </b>"</label>
   1.471 -        </text>
   1.472 -        <entry>
   1.473 -          <input>. /etc/network.conf; echo "$INTERFACE"</input>
   1.474 -          <variable>INTERFACE</variable>
   1.475 -        </entry>
   1.476 -      </hbox>
   1.477 -      <hbox>
   1.478 -        <text use-markup="true">
   1.479 -          <label>"<b>IP:                </b>"</label>
   1.480 -        </text>
   1.481 -        <entry>
   1.482 -          <input>. /etc/network.conf; echo "$IP"</input>
   1.483 -          <variable>IP</variable>
   1.484 -        </entry>
   1.485 -      </hbox>
   1.486 -      <hbox>
   1.487 -        <text use-markup="true">
   1.488 -          <label>"<b>Netmask:    </b>"</label>
   1.489 -        </text>
   1.490 -        <entry>
   1.491 -          <input>. /etc/network.conf; echo "$NETMASK"</input>
   1.492 -          <variable>NETMASK</variable>
   1.493 -        </entry>
   1.494 -      </hbox>
   1.495 -      <hbox>
   1.496 -        <text use-markup="true">
   1.497 -          <label>"<b>Gateway:    </b>"</label>
   1.498 -        </text>
   1.499 -        <entry>
   1.500 -          <input>. /etc/network.conf; echo "$GATEWAY"</input>
   1.501 -          <variable>GATEWAY</variable>
   1.502 -        </entry>
   1.503 -      </hbox>
   1.504 -      <hbox>
   1.505 -        <text use-markup="true">
   1.506 -          <label>"<b>DNS server: </b>"</label>
   1.507 -        </text>
   1.508 -        <entry>
   1.509 -          <input>. /etc/network.conf; echo "$DNS_SERVER"</input>
   1.510 -          <variable>DNS_SERVER</variable>
   1.511 -        </entry>
   1.512 -      </hbox>
   1.513 -      <hbox>
   1.514 -        <button>
   1.515 -          <label>Start</label>
   1.516 -          <input file icon="forward"></input>
   1.517 -          <action>ifconfig lo down</action>
   1.518 -          <action>ifconfig $INTERFACE down</action>
   1.519 -          <action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
   1.520 -          <action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
   1.521 -          <action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
   1.522 -          <action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
   1.523 -          <action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
   1.524 -          <action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
   1.525 -          <action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
   1.526 -          <action>/etc/init.d/network.sh</action>
   1.527 -        </button>
   1.528 -        <button>
   1.529 -          <label>Stop</label>
   1.530 -          <input file icon="stop"></input>
   1.531 -          <action>echo -n "Stopping interface : $INTERFACE... "</action>
   1.532 -          <action>ifconfig $INTERFACE down; echo "done"</action>
   1.533 -        </button>
   1.534 -      </hbox>
   1.535 -    </frame>
   1.536 +		</label>
   1.537 +	</text>
   1.538 +	<hbox>
   1.539 +		<text use-markup="true">
   1.540 +			<label>"<b>Interface:</b>"</label>
   1.541 +		</text>
   1.542 +		<entry>
   1.543 +			<input>. /etc/network.conf; echo "$INTERFACE"</input>
   1.544 +			<variable>INTERFACE</variable>
   1.545 +		</entry>
   1.546 +	</hbox>
   1.547 +	<hbox>
   1.548 +		<text use-markup="true">
   1.549 +			<label>"<b>Options:  </b>"</label>
   1.550 +		</text>
   1.551 +		<entry>
   1.552 +			<default>-b</default>
   1.553 +			<variable>UDHCPC_OPTS</variable>
   1.554 +		</entry>
   1.555 +		<button>
   1.556 +			<input file icon="help"></input>
   1.557 +			<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>
   1.558 +		</button>
   1.559 +	</hbox>
   1.560 +	<hbox>
   1.561 +		<text use-markup="true">
   1.562 +			<label>"<b>Script:     </b>"</label>
   1.563 +		</text>
   1.564 +		<entry editable="false">
   1.565 +			<default>/usr/share/udhcpc/default.script</default>
   1.566 +			<variable>UDHCPC_SCRIPT</variable>
   1.567 +		</entry>
   1.568 +		<button>
   1.569 +			<input file icon="accessories-text-editor"></input>
   1.570 +			<action type="lauch">leafpad $UDHCPC_SCRIPT</action>
   1.571 +		</button>
   1.572 +	</hbox>
   1.573 +	<hbox>
   1.574 +		<button>
   1.575 +			<label>Start</label>
   1.576 +			<input file icon="forward"></input>
   1.577 +			<action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
   1.578 +			<action>sed -i s/DHCP=\"no\"/DHCP=\"yes\"/ /etc/network.conf</action>
   1.579 +			<action>sed -i s/STATIC=\"yes\"/STATIC=\"no\"/ /etc/network.conf</action>
   1.580 +			<action>udhcpc $UDHCPC_OPTS -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid</action>
   1.581 +		</button>
   1.582 +		<button>
   1.583 +			<label>Stop</label>
   1.584 +			<input file icon="stop"></input>
   1.585 +			<action>echo -n "Stopping interface : $INTERFACE... "</action>
   1.586 +			<action>ifconfig $INTERFACE down</action>
   1.587 +			<action>killall -q udhcpc; echo "done"</action>
   1.588 +		</button>
   1.589 +	</hbox>
   1.590 +</frame>'
   1.591  
   1.592 -    <frame PPPoE>
   1.593 -      <hbox>
   1.594 -        <text use-markup="true">
   1.595 -          <label>"<b>Name        :</b>"</label>
   1.596 -        </text>
   1.597 -        <entry>
   1.598 -          <input>NAME=$(grep -s ^name /etc/ppp/options); echo "${NAME#* }"</input>
   1.599 -          <variable>NAME</variable>
   1.600 -        </entry>
   1.601 -      </hbox>
   1.602 -      <hbox>
   1.603 -        <text use-markup="true">
   1.604 -          <label>"<b>Username :</b>"</label>
   1.605 -        </text>
   1.606 -        <entry>
   1.607 -          <variable>USER</variable>
   1.608 -        </entry>
   1.609 -      </hbox>
   1.610 -      <hbox>
   1.611 -        <text use-markup="true">
   1.612 -          <label>"<b>Password :</b>"</label>
   1.613 -        </text>
   1.614 -        <entry>
   1.615 -          <variable>PASS</variable>
   1.616 -        </entry>
   1.617 -      </hbox>
   1.618 -      <hbox>
   1.619 -        <button>
   1.620 -          <input file icon="help"></input>
   1.621 -	  <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>
   1.622 -        </button>
   1.623 -        <button>
   1.624 -          <input file icon="browser"></input>
   1.625 -	  <label>man</label>
   1.626 -	  <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "pppd man (q to quit)" -e ". /etc/profile; man 8 pppd"</action>
   1.627 -        </button>
   1.628 -        <button>
   1.629 -          <input file icon="accessories-text-editor"></input>
   1.630 -          <label>Tune</label>
   1.631 -	  <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
   1.632 -          <action type="lauch">leafpad /etc/ppp/options</action>
   1.633 -        </button>
   1.634 -        <button>
   1.635 -          <label>Start</label>
   1.636 -          <input file icon="forward"></input>
   1.637 -	  <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
   1.638 -	  && echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/pap-secrets</action>
   1.639 -	  <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
   1.640 -	  && echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/chap-secrets</action>
   1.641 -	  <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
   1.642 -          <action>killall udhcpc</action>
   1.643 -	  <action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
   1.644 -	  <action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
   1.645 -          <action>pppd $INTERFACE &</action>
   1.646 -        </button>
   1.647 -        <button>
   1.648 -          <label>Stop</label>
   1.649 -          <input file icon="stop"></input>
   1.650 -	  <action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
   1.651 -          <action>killall pppd</action>
   1.652 -        </button>
   1.653 -      </hbox>
   1.654 -    </frame>
   1.655 +# Static/fixed IP settings.
   1.656 +tmp=${tmp}'
   1.657 +<frame Ethernet fixed IP>
   1.658 +	<hbox>
   1.659 +		<text use-markup="true">
   1.660 +			<label>"<b>Interface:   </b>"</label>
   1.661 +		</text>
   1.662 +		<entry>
   1.663 +			<input>. /etc/network.conf; echo "$INTERFACE"</input>
   1.664 +			<variable>INTERFACE</variable>
   1.665 +		</entry>
   1.666 +	</hbox>
   1.667 +	<hbox>
   1.668 +		<text use-markup="true">
   1.669 +			<label>"<b>IP:                </b>"</label>
   1.670 +		</text>
   1.671 +		<entry>
   1.672 +			<input>. /etc/network.conf; echo "$IP"</input>
   1.673 +			<variable>IP</variable>
   1.674 +		</entry>
   1.675 +	</hbox>
   1.676 +	<hbox>
   1.677 +		<text use-markup="true">
   1.678 +			<label>"<b>Netmask:    </b>"</label>
   1.679 +		</text>
   1.680 +		<entry>
   1.681 +			<input>. /etc/network.conf; echo "$NETMASK"</input>
   1.682 +			<variable>NETMASK</variable>
   1.683 +		</entry>
   1.684 +	</hbox>
   1.685 +	<hbox>
   1.686 +		<text use-markup="true">
   1.687 +			<label>"<b>Gateway:    </b>"</label>
   1.688 +		</text>
   1.689 +		<entry>
   1.690 +			<input>. /etc/network.conf; echo "$GATEWAY"</input>
   1.691 +			<variable>GATEWAY</variable>
   1.692 +		</entry>
   1.693 +	</hbox>
   1.694 +	<hbox>
   1.695 +		<text use-markup="true">
   1.696 +			<label>"<b>DNS server: </b>"</label>
   1.697 +		</text>
   1.698 +		<entry>
   1.699 +			<input>. /etc/network.conf; echo "$DNS_SERVER"</input>
   1.700 +			<variable>DNS_SERVER</variable>
   1.701 +		</entry>
   1.702 +	</hbox>'
   1.703  
   1.704 -    <frame PPP>
   1.705 -      <hbox>
   1.706 -        <text use-markup="true">
   1.707 -          <label>"<b>Username :</b>"</label>
   1.708 -        </text>
   1.709 -        <entry>
   1.710 -	  <input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
   1.711 -          <variable>USER</variable>
   1.712 -        </entry>
   1.713 -      </hbox>
   1.714 -      <hbox>
   1.715 -        <text use-markup="true">
   1.716 -          <label>"<b>Password :</b>"</label>
   1.717 -        </text>
   1.718 -        <entry>
   1.719 -	  <input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
   1.720 -          <variable>PASS</variable>
   1.721 -        </entry>
   1.722 -      </hbox>
   1.723 -      <hbox>
   1.724 -        <text use-markup="true">
   1.725 -          <label>"<b>Telephone:</b>"</label>
   1.726 -        </text>
   1.727 -        <entry>
   1.728 -	  <input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
   1.729 -          <variable>PHONE</variable>
   1.730 -        </entry>
   1.731 -      </hbox>
   1.732 -      <hbox>
   1.733 -        <button>
   1.734 -          <input file icon="help"></input>
   1.735 -	  <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>
   1.736 -        </button>
   1.737 -        <button>
   1.738 -          <input file icon="browser"></input>
   1.739 -	  <label>man</label>
   1.740 -	  <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "pppd man (q to quit)" -e ". /etc/profile; man 8 pppd"</action>
   1.741 -        </button>
   1.742 -        <button>
   1.743 -          <input file icon="accessories-text-editor"></input>
   1.744 -          <label>Tune</label>
   1.745 -	  <action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=$NAME/" /etc/ppp/scripts/ppp-on</action>
   1.746 -	  <action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=$PASS/" /etc/ppp/scripts/ppp-on</action>
   1.747 -	  <action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=$PHONE/" /etc/ppp/scripts/ppp-on</action>
   1.748 -          <action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
   1.749 -        </button>
   1.750 -        <button>
   1.751 -          <label>Start</label>
   1.752 -          <input file icon="forward"></input>
   1.753 -	  <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
   1.754 -	  && echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/pap-secrets</action>
   1.755 -	  <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
   1.756 -	  && echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/chap-secrets</action>
   1.757 -	  <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
   1.758 -          <action>/etc/ppp/scripts/ppp-off</action>
   1.759 -          <action>/etc/ppp/scripts/ppp-on &</action>
   1.760 -        </button>
   1.761 -        <button>
   1.762 -          <label>Stop</label>
   1.763 -          <input file icon="stop"></input>
   1.764 -          <action>/etc/ppp/scripts/ppp-off</action>
   1.765 -        </button>
   1.766 -      </hbox>
   1.767 -    </frame>'
   1.768 +# Static/fixed IP actions (should go in a function).
   1.769 +tmp=${tmp}'
   1.770 +	<hbox>
   1.771 +		<button>
   1.772 +		<label>Start</label>
   1.773 +			<input file icon="forward"></input>
   1.774 +			<action>ifconfig lo down</action>
   1.775 +			<action>ifconfig $INTERFACE down</action>
   1.776 +			<action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE=\"$INTERFACE\"/ /etc/network.conf</action>
   1.777 +			<action>sed -i s/DHCP=\"yes\"/DHCP=\"no\"/ /etc/network.conf</action>
   1.778 +			<action>sed -i s/STATIC=\"no\"/STATIC=\"yes\"/ /etc/network.conf</action>
   1.779 +			<action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP=\"$IP\"/ /etc/network.conf</action>
   1.780 +			<action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK=\"$NETMASK\"/ /etc/network.conf</action>
   1.781 +			<action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY=\"$GATEWAY\"/ /etc/network.conf</action>
   1.782 +			<action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER=\"$DNS_SERVER\"/ /etc/network.conf</action>
   1.783 +			<action>/etc/init.d/network.sh</action>
   1.784 +		</button>
   1.785 +		<button>
   1.786 +			<label>Stop</label>
   1.787 +			<input file icon="stop"></input>
   1.788 +			<action>echo -n "Stopping interface : $INTERFACE... "</action>
   1.789 +			<action>ifconfig $INTERFACE down; echo "done"</action>
   1.790 +		</button>
   1.791 +	</hbox>
   1.792 +</frame>'
   1.793 +
   1.794 +# PPPoe settings.
   1.795 +tmp=${tmp}'
   1.796 +<frame PPPoE>
   1.797 +	<hbox>
   1.798 +		<text use-markup="true">
   1.799 +			<label>"<b>Name:       </b>"</label>
   1.800 +		</text>
   1.801 +		<entry>
   1.802 +			<input>NAME=$(grep -s ^name /etc/ppp/options); echo "${NAME#* }"</input>
   1.803 +			<variable>NAME</variable>
   1.804 +		</entry>
   1.805 +	</hbox>
   1.806 +	<hbox>
   1.807 +		<text use-markup="true">
   1.808 +			<label>"<b>Username:</b>"</label>
   1.809 +		</text>
   1.810 +		<entry>
   1.811 +			<variable>USER</variable>
   1.812 +		</entry>
   1.813 +	</hbox>
   1.814 +	<hbox>
   1.815 +		<text use-markup="true">
   1.816 +			<label>"<b>Password:</b>"</label>
   1.817 +		</text>
   1.818 +		<entry>
   1.819 +			<variable>PASS</variable>
   1.820 +		</entry>
   1.821 +	</hbox>
   1.822 +	<hbox>
   1.823 +		<button>
   1.824 +			<input file icon="help"></input>
   1.825 +			<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>
   1.826 +		</button>
   1.827 +		<button>
   1.828 +			<input file icon="browser"></input>
   1.829 +			<label>man</label>
   1.830 +			<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "pppd man (q to quit)" -e ". /etc/profile; man 8 pppd"</action>
   1.831 +		</button>
   1.832 +		<button>
   1.833 +			<input file icon="accessories-text-editor"></input>
   1.834 +			<label>Tune</label>
   1.835 +			<action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
   1.836 +			<action type="lauch">leafpad /etc/ppp/options</action>
   1.837 +		</button>
   1.838 +		<button>
   1.839 +			<label>Start</label>
   1.840 +			<input file icon="forward"></input>
   1.841 +			<action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
   1.842 +			&& echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/pap-secrets</action>
   1.843 +			<action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
   1.844 +			&& echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/chap-secrets</action>
   1.845 +			<action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
   1.846 +			<action>killall udhcpc</action>
   1.847 +			<action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
   1.848 +			<action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
   1.849 +			<action>pppd $INTERFACE &</action>
   1.850 +		</button>
   1.851 +		<button>
   1.852 +			<label>Stop</label>
   1.853 +			<input file icon="stop"></input>
   1.854 +			<action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
   1.855 +			<action>killall pppd</action>
   1.856 +		</button>
   1.857 +	</hbox>
   1.858 +</frame>'
   1.859 +
   1.860 +# PPP settings.
   1.861 +tmp=${tmp}'
   1.862 +<frame PPP>
   1.863 +	<hbox>
   1.864 +		<text use-markup="true">
   1.865 +			<label>"<b>Username: </b>"</label>
   1.866 +		</text>
   1.867 +		<entry>
   1.868 +			<input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
   1.869 +			<variable>USER</variable>
   1.870 +		</entry>
   1.871 +	</hbox>
   1.872 +	<hbox>
   1.873 +		<text use-markup="true">
   1.874 +			<label>"<b>Password: </b>"</label>
   1.875 +		</text>
   1.876 +		<entry>
   1.877 +			<input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
   1.878 +			<variable>PASS</variable>
   1.879 +		</entry>
   1.880 +	</hbox>
   1.881 +	<hbox>
   1.882 +		<text use-markup="true">
   1.883 +			<label>"<b>Telephone:</b>"</label>
   1.884 +		</text>
   1.885 +		<entry>
   1.886 +			<input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
   1.887 +			<variable>PHONE</variable>
   1.888 +		</entry>
   1.889 +	</hbox>
   1.890 +	<hbox>
   1.891 +		<button>
   1.892 +			<input file icon="help"></input>
   1.893 +			<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>
   1.894 +		</button>
   1.895 +		<button>
   1.896 +			<input file icon="browser"></input>
   1.897 +			<label>man</label>
   1.898 +			<action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x24 -title "pppd man (q to quit)" -e ". /etc/profile; man 8 pppd"</action>
   1.899 +		</button>
   1.900 +		<button>
   1.901 +			<input file icon="accessories-text-editor"></input>
   1.902 +			<label>Tune</label>
   1.903 +			<action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=$NAME/" /etc/ppp/scripts/ppp-on</action>
   1.904 +			<action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=$PASS/" /etc/ppp/scripts/ppp-on</action>
   1.905 +			<action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=$PHONE/" /etc/ppp/scripts/ppp-on</action>
   1.906 +			<action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
   1.907 +		</button>
   1.908 +		<button>
   1.909 +			<label>Start</label>
   1.910 +			<input file icon="forward"></input>
   1.911 +			<action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
   1.912 +			&& echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/pap-secrets</action>
   1.913 +			<action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
   1.914 +			&& echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/chap-secrets</action>
   1.915 +			<action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
   1.916 +			<action>/etc/ppp/scripts/ppp-off</action>
   1.917 +			<action>/etc/ppp/scripts/ppp-on &</action>
   1.918 +		</button>
   1.919 +		<button>
   1.920 +			<label>Stop</label>
   1.921 +			<input file icon="stop"></input>
   1.922 +			<action>/etc/ppp/scripts/ppp-off</action>
   1.923 +		</button>
   1.924 +	</hbox>
   1.925 +</frame>'
   1.926 +
   1.927 +#
   1.928 +# TODO: Indent with tabs from there
   1.929 +#
   1.930 +
   1.931 +# Wireless tab
   1.932  NET_BOX="$NET_BOX$tmp"
   1.933  tmp='<frame Wireless>
   1.934      <notebook labels="Interface|Extra parameters'