slitaz-tools rev 461

netbox:split networking, server, gui and tab engine
author Rohit Joshi <jozee@slitaz.org>
date Wed Mar 24 06:33:32 2010 -0400 (2010-03-24)
parents 0d8f225b0185
children eae75165f38c
files lib/gui_functions tinyutils/netbox
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/gui_functions	Wed Mar 24 06:33:32 2010 -0400
     1.3 @@ -0,0 +1,211 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +#
     1.7 +# Tab display engine
     1.8 +#
     1.9 +######################################################
    1.10 +
    1.11 +use_tab()
    1.12 +{
    1.13 +local tmp=''
    1.14 +case "$2" in
    1.15 +header|body)
    1.16 +	$1 | while read exe name call; do
    1.17 +	  case "$exe" in
    1.18 +	  \#*) continue;;
    1.19 +	  /*)  [ -e $exe ] || continue;;
    1.20 +	  *)   which $exe > /dev/null || continue
    1.21 +	  esac
    1.22 +	  if [ "$2" == "header" ]; then
    1.23 +	    echo -n "$tmp$name"
    1.24 +	    tmp='|'
    1.25 +	  else
    1.26 +	    $call
    1.27 +	  fi
    1.28 +	done
    1.29 +	;;
    1.30 +*)
    1.31 +	tmp=$(use_tab $1 header)
    1.32 +	echo "$tmp" | grep -q \| && cat <<EOT
    1.33 +<notebook labels="$tmp">
    1.34 +EOT
    1.35 +	[ -n "$tmp" ] && cat <<EOT
    1.36 +$(use_tab $1 body)
    1.37 +EOT
    1.38 +	echo "$tmp" | grep -q \| && cat <<EOT
    1.39 +</notebook>
    1.40 +EOT
    1.41 +	;;
    1.42 +esac
    1.43 +}
    1.44 +
    1.45 +#
    1.46 +# GUI functions
    1.47 +#
    1.48 +############################################################
    1.49 +
    1.50 +xterm="xterm -fa MiscFixed -fs 11"
    1.51 +helpbutton()
    1.52 +{
    1.53 +	local label;
    1.54 +        label="<label>$3</label>"
    1.55 +	[ -n "$3" ] || label=""
    1.56 +	cat << EOT
    1.57 +<button>
    1.58 +	<input file icon="help"></input>$label
    1.59 +	<action>$xterm -geometry $2 -title "$1 help (q to quit)" -e "( echo ; $(which $1) --help 2>&1 ) | less"</action>
    1.60 +</button>
    1.61 +EOT
    1.62 +}
    1.63 +
    1.64 +editbutton()
    1.65 +{
    1.66 +	cat << EOT
    1.67 +<button>
    1.68 +	<input file icon="accessories-text-editor"></input>
    1.69 +	<action type="lauch">leafpad $1</action>
    1.70 +</button>
    1.71 +EOT
    1.72 +}
    1.73 +
    1.74 +manbutton()
    1.75 +{
    1.76 +	cat << EOT
    1.77 +<button>
    1.78 +	<input file icon="browser"></input>
    1.79 +	<label>man</label>
    1.80 +	<action>$xterm -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
    1.81 +</button>
    1.82 +EOT
    1.83 +}
    1.84 +
    1.85 +helpdaemon()
    1.86 +{
    1.87 +	cat << EOT
    1.88 +<hbox>
    1.89 +	<text use-markup="true">
    1.90 +		<label>"<b>$3</b>"</label>
    1.91 +	</text>
    1.92 +	<entry editable="false">
    1.93 +EOT
    1.94 +	eval tmp=\$$3
    1.95 +	[ -n "$tmp" ] && cat << EOT
    1.96 +		<default>$tmp</default>
    1.97 +EOT
    1.98 +	cat << EOT
    1.99 +		<variable>$4</variable>
   1.100 +	</entry>
   1.101 +EOT
   1.102 +	[ -n "$6" ] || cat << EOT
   1.103 +$(helpbutton $1 $2)
   1.104 +EOT
   1.105 +	[ -n "$5" ] && cat << EOT
   1.106 +$(manbutton $5 $1)
   1.107 +EOT
   1.108 +	cat << EOT
   1.109 +$(editbutton /etc/daemons.conf)
   1.110 +</hbox>
   1.111 +EOT
   1.112 +}
   1.113 +
   1.114 +datafile()
   1.115 +{
   1.116 +	cat << EOT
   1.117 +<hbox>
   1.118 +	<text use-markup="true">
   1.119 +		<label>"<b>$3</b>"</label>
   1.120 +	</text>
   1.121 + 	<entry editable="false">
   1.122 +EOT
   1.123 +	[ -n "$1" ] && cat << EOT
   1.124 +		<default>$1</default>
   1.125 +EOT
   1.126 +	cat << EOT
   1.127 +		<variable>$2</variable>
   1.128 +	</entry>
   1.129 +EOT
   1.130 +	[ -n "$4" ] && cat << EOT
   1.131 +$(manbutton $4)
   1.132 +EOT
   1.133 +	cat << EOT
   1.134 +$(editbutton \$$2)
   1.135 +</hbox>
   1.136 +EOT
   1.137 +}
   1.138 +
   1.139 +configfile()
   1.140 +{
   1.141 +	datafile "$1" $2 'Configuration:' "$3"
   1.142 +}
   1.143 +
   1.144 +BROWSER=''
   1.145 +for i in firefox opera dillo midori netsurf links ; do
   1.146 +	which $i > /dev/null && BROWSER="$i" && break
   1.147 +done
   1.148 +case "$BROWSER" in
   1.149 +links) BROWSER="links -g ";;
   1.150 +esac
   1.151 +
   1.152 +webbutton()
   1.153 +{
   1.154 +	[ -f "/var/lib/tazpkg/installed/$1/receipt" ] && 
   1.155 +	[ -n "$BROWSER" ] && cat << EOT
   1.156 +<button>
   1.157 +	<input file icon="browser"></input>
   1.158 +	<label>web</label>
   1.159 +	<action>. /var/lib/tazpkg/installed/$1/receipt ; $BROWSER \$WEB_SITE &</action>
   1.160 +</button>
   1.161 +EOT
   1.162 +}
   1.163 +
   1.164 +wikibutton()
   1.165 +{
   1.166 +[ -n "$BROWSER" ] && cat <<EOT
   1.167 +        <button>
   1.168 +          <input file icon="browser"></input>
   1.169 +	  <label>Wiki</label>
   1.170 +	  <action>$BROWSER $1 &</action>
   1.171 +        </button>
   1.172 +EOT
   1.173 +}
   1.174 +
   1.175 +startstopdaemon()
   1.176 +{
   1.177 +	local pkg
   1.178 +	pkg=$1
   1.179 +	[ -n "$2" ] && pkg=$2
   1.180 +	if [ ! -d /var/lib/tazpkg/installed/${pkg} ]; then
   1.181 +		installbox $pkg
   1.182 +	fi
   1.183 +	webbutton $pkg
   1.184 +	cat << EOT
   1.185 +<button>
   1.186 +	<label>Start</label>
   1.187 +	<input file icon="forward"></input>
   1.188 +	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   1.189 +	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"$1 \1\\"/" /etc/rcS.conf</action>
   1.190 +	<action>/etc/init.d/$1 start</action>
   1.191 +</button>
   1.192 +<button>
   1.193 +	<label>Stop</label>
   1.194 +	<input file icon="stop"></input>
   1.195 +	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   1.196 +	<action>/etc/init.d/$1 stop</action>
   1.197 +</button>
   1.198 +EOT
   1.199 +}
   1.200 +
   1.201 +installbox()
   1.202 +{
   1.203 +	cat << EOT
   1.204 +<hbox>
   1.205 +	
   1.206 +	<button>
   1.207 +		<input file icon="go-jump"></input>
   1.208 +		<label>Install</label>
   1.209 +		<action>$xterm -geometry 80x17 -title "$1 install" -e "yes y | tazpkg get-install $1 ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
   1.210 +		<action type="exit">restart</action>
   1.211 +	</button>
   1.212 +</hbox>
   1.213 +EOT
   1.214 +}
     2.1 --- a/tinyutils/netbox	Wed Mar 24 05:15:28 2010 -0400
     2.2 +++ b/tinyutils/netbox	Wed Mar 24 06:33:32 2010 -0400
     2.3 @@ -5,7 +5,9 @@
     2.4  #
     2.5  # (c) - SliTaz GNU/Linux 2009.
     2.6  #
     2.7 -VERSION=20090812
     2.8 +VERSION=20100315
     2.9 +
    2.10 +. /usr/lib/slitaz/gui_functions
    2.11  
    2.12  # Check if user is root.
    2.13  check_root()
    2.14 @@ -18,6 +20,7 @@
    2.15  	fi
    2.16  }
    2.17  
    2.18 +
    2.19  #
    2.20  # Functions called by the connection tab to list interfaces.
    2.21  #
    2.22 @@ -66,176 +69,6 @@
    2.23  		continue ;;
    2.24  esac
    2.25  
    2.26 -#
    2.27 -# GUI functions
    2.28 -#
    2.29 -############################################################
    2.30 -
    2.31 -xterm="xterm -fa MiscFixed -fs 11 -bg gray93 -fg black"
    2.32 -helpbutton()
    2.33 -{
    2.34 -	local label;
    2.35 -        label="<label>$3</label>"
    2.36 -	[ -n "$3" ] || label=""
    2.37 -	cat << EOT
    2.38 -<button>
    2.39 -	<input file icon="help"></input>$label
    2.40 -	<action>$xterm -geometry $2 -title "$1 help (q to quit)" -e "( echo ; $(which $1) --help 2>&1 ) | less"</action>
    2.41 -</button>
    2.42 -EOT
    2.43 -}
    2.44 -
    2.45 -editbutton()
    2.46 -{
    2.47 -	cat << EOT
    2.48 -<button>
    2.49 -	<input file icon="accessories-text-editor"></input>
    2.50 -	<action type="lauch">leafpad $1</action>
    2.51 -</button>
    2.52 -EOT
    2.53 -}
    2.54 -
    2.55 -manbutton()
    2.56 -{
    2.57 -	cat << EOT
    2.58 -<button>
    2.59 -	<input file icon="browser"></input>
    2.60 -	<label>man</label>
    2.61 -	<action>$xterm -geometry 80x24 -title "$2 man (q to quit)" -e ". /etc/profile; man $1 $2"</action>
    2.62 -</button>
    2.63 -EOT
    2.64 -}
    2.65 -
    2.66 -helpdaemon()
    2.67 -{
    2.68 -	cat << EOT
    2.69 -<hbox>
    2.70 -	<text use-markup="true">
    2.71 -		<label>"<b>$3</b>"</label>
    2.72 -	</text>
    2.73 -	<entry editable="false">
    2.74 -EOT
    2.75 -	eval tmp=\$$3
    2.76 -	[ -n "$tmp" ] && cat << EOT
    2.77 -		<default>$tmp</default>
    2.78 -EOT
    2.79 -	cat << EOT
    2.80 -		<variable>$4</variable>
    2.81 -	</entry>
    2.82 -EOT
    2.83 -	[ -n "$6" ] || cat << EOT
    2.84 -$(helpbutton $1 $2)
    2.85 -EOT
    2.86 -	[ -n "$5" ] && cat << EOT
    2.87 -$(manbutton $5 $1)
    2.88 -EOT
    2.89 -	cat << EOT
    2.90 -$(editbutton /etc/daemons.conf)
    2.91 -</hbox>
    2.92 -EOT
    2.93 -}
    2.94 -
    2.95 -datafile()
    2.96 -{
    2.97 -	cat << EOT
    2.98 -<hbox>
    2.99 -	<text use-markup="true">
   2.100 -		<label>"<b>$3</b>"</label>
   2.101 -	</text>
   2.102 - 	<entry editable="false">
   2.103 -EOT
   2.104 -	[ -n "$1" ] && cat << EOT
   2.105 -		<default>$1</default>
   2.106 -EOT
   2.107 -	cat << EOT
   2.108 -		<variable>$2</variable>
   2.109 -	</entry>
   2.110 -EOT
   2.111 -	[ -n "$4" ] && cat << EOT
   2.112 -$(manbutton $4)
   2.113 -EOT
   2.114 -	cat << EOT
   2.115 -$(editbutton \$$2)
   2.116 -</hbox>
   2.117 -EOT
   2.118 -}
   2.119 -
   2.120 -configfile()
   2.121 -{
   2.122 -	datafile "$1" $2 'Configuration:' "$3"
   2.123 -}
   2.124 -
   2.125 -BROWSER=''
   2.126 -for i in firefox opera dillo midori netsurf links ; do
   2.127 -	which $i > /dev/null && BROWSER="$i" && break
   2.128 -done
   2.129 -case "$BROWSER" in
   2.130 -links) BROWSER="links -g ";;
   2.131 -esac
   2.132 -
   2.133 -webbutton()
   2.134 -{
   2.135 -	[ -f "/var/lib/tazpkg/installed/$1/receipt" ] && 
   2.136 -	[ -n "$BROWSER" ] && cat << EOT
   2.137 -<button>
   2.138 -	<input file icon="browser"></input>
   2.139 -	<label>web</label>
   2.140 -	<action>. /var/lib/tazpkg/installed/$1/receipt ; $BROWSER \$WEB_SITE &</action>
   2.141 -</button>
   2.142 -EOT
   2.143 -}
   2.144 -
   2.145 -wikibutton()
   2.146 -{
   2.147 -[ -n "$BROWSER" ] && cat <<EOT
   2.148 -        <button>
   2.149 -          <input file icon="browser"></input>
   2.150 -	  <label>Wiki</label>
   2.151 -	  <action>$BROWSER $1 &</action>
   2.152 -        </button>
   2.153 -EOT
   2.154 -}
   2.155 -
   2.156 -startstopdaemon()
   2.157 -{
   2.158 -	local pkg
   2.159 -	pkg=$1
   2.160 -	[ -n "$2" ] && pkg=$2
   2.161 -	webbutton $pkg
   2.162 -	cat << EOT
   2.163 -<button>
   2.164 -	<label>Start</label>
   2.165 -	<input file icon="forward"></input>
   2.166 -	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   2.167 -	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"$1 \1\\"/" /etc/rcS.conf</action>
   2.168 -	<action>/etc/init.d/$1 start</action>
   2.169 -</button>
   2.170 -<button>
   2.171 -	<label>Stop</label>
   2.172 -	<input file icon="stop"></input>
   2.173 -	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)$1 \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   2.174 -	<action>/etc/init.d/$1 stop</action>
   2.175 -</button>
   2.176 -EOT
   2.177 -}
   2.178 -
   2.179 -installbox()
   2.180 -{
   2.181 -	cat << EOT
   2.182 -<hbox>
   2.183 -	<text wrap="true" use-markup="true">
   2.184 -		<label>"<i>The package <b>$1</b> is not yet installed.</i>"</label>
   2.185 -	</text>
   2.186 -	<button>
   2.187 -		<input file icon="go-jump"></input>
   2.188 -		<label>Install</label>
   2.189 -		<action>$xterm -geometry 80x17 -title "$1 install" -e "yes y | tazpkg get-install $1 ; echo -e \"----\n\nENTER to continue...\" && read close"</action>
   2.190 -		<action type="exit">restart</action>
   2.191 -	</button>
   2.192 -</hbox>
   2.193 -EOT
   2.194 -}
   2.195 -
   2.196  set_ipup()
   2.197  {
   2.198  	[ -f /etc/ppp/ip-up ] && return
   2.199 @@ -330,44 +163,7 @@
   2.200  	exit 1
   2.201  fi
   2.202  
   2.203 -#
   2.204 -# Tab display engine
   2.205 -#
   2.206 -######################################################
   2.207  
   2.208 -use_tab()
   2.209 -{
   2.210 -local tmp=''
   2.211 -case "$2" in
   2.212 -header|body)
   2.213 -	$1 | while read exe name call; do
   2.214 -	  case "$exe" in
   2.215 -	  \#*) continue;;
   2.216 -	  /*)  [ -e $exe ] || continue;;
   2.217 -	  *)   which $exe > /dev/null || continue
   2.218 -	  esac
   2.219 -	  if [ "$2" == "header" ]; then
   2.220 -	    echo -n "$tmp$name"
   2.221 -	    tmp='|'
   2.222 -	  else
   2.223 -	    $call
   2.224 -	  fi
   2.225 -	done
   2.226 -	;;
   2.227 -*)
   2.228 -	tmp=$(use_tab $1 header)
   2.229 -	echo "$tmp" | grep -q \| && cat <<EOT
   2.230 -<notebook labels="$tmp">
   2.231 -EOT
   2.232 -	[ -n "$tmp" ] && cat <<EOT
   2.233 -$(use_tab $1 body)
   2.234 -EOT
   2.235 -	echo "$tmp" | grep -q \| && cat <<EOT
   2.236 -</notebook>
   2.237 -EOT
   2.238 -	;;
   2.239 -esac
   2.240 -}
   2.241  
   2.242  #
   2.243  # Status wire interfaces
   2.244 @@ -460,22 +256,6 @@
   2.245  EOT
   2.246  }
   2.247  
   2.248 -#
   2.249 -# Status servers
   2.250 -#
   2.251 -tab_status_servers()
   2.252 -{
   2.253 -local servers
   2.254 -servers="dropbear sshd inetd dhcpd dnsd named rsync httpd mbd vnc pppd knock"
   2.255 -cat <<EOT
   2.256 -<frame Servers>
   2.257 -	<text wrap="false" width-chars="58">
   2.258 -		<input>for i in $servers; do ps ww | grep \$i | grep -v grep | fold -s; done</input>
   2.259 -	</text>
   2.260 -</frame>
   2.261 -EOT
   2.262 -}
   2.263 -
   2.264  data_status()
   2.265  {
   2.266  cat <<EOT
   2.267 @@ -483,7 +263,6 @@
   2.268  iwconfig    Wireless\ interfaces  tab_status_wifi_iface
   2.269  iwlist      Wireless\ networks    tab_status_wifi_net
   2.270  route       Routing               tab_status_route
   2.271 -ps          Servers               tab_status_servers
   2.272  EOT
   2.273  }
   2.274  
   2.275 @@ -1082,611 +861,6 @@
   2.276  use_tab data_vpn
   2.277  }
   2.278  
   2.279 -sshremote()
   2.280 -{
   2.281 -	cat << EOT
   2.282 -      <hbox>
   2.283 -        <text use-markup="true">
   2.284 -          <label>"<b>Remote  :</b>"</label>
   2.285 -        </text>
   2.286 -        <entry>
   2.287 -          <variable>$2</variable>
   2.288 -	  <default>user@elsewhere</default>
   2.289 -        </entry>
   2.290 -        <button>
   2.291 -          <input file icon="utilities-terminal"></input>
   2.292 -	  <label>Connect</label>
   2.293 -	  <action>xterm -fa MiscFixed -fs 11 -bg black -fg white -geometry 80x25 -title "$1" -e "$1 \$$2 ; echo -e \"----\nENTER to continue...\" && read close" &</action>
   2.294 -        </button>
   2.295 -        <button>
   2.296 -          <input file icon="go-up"></input>
   2.297 -	  <label>Send key</label>
   2.298 -	  <action>$xterm -geometry 80x10 -title "send ssh key" -e "$0 call sendsshkey \$$2; echo -e \"----\nENTER to continue...\" && read close"</action>
   2.299 -        </button>
   2.300 -      </hbox>
   2.301 -EOT
   2.302 -}
   2.303 -
   2.304 -#
   2.305 -# Dropbear client & server
   2.306 -#
   2.307 -tab_dropbear()
   2.308 -{
   2.309 -. /etc/daemons.conf
   2.310 -set -- $DROPBEAR_OPTIONS
   2.311 -while [ -n "$2" ]; do
   2.312 -  [ "$1" = "-b" ] && DROPBEAR_BANNER="$2" && break
   2.313 -  shift
   2.314 -done
   2.315 -
   2.316 -cat <<EOT
   2.317 -     <frame Dropbear>
   2.318 -$(helpdaemon dropbear 80x30 DROPBEAR_OPTIONS DROPBEAR_OPTS)
   2.319 -$(datafile /etc/dropbear/banner DROPBEAR_BANNER 'Banner   :')
   2.320 -$(sshremote DROPBEAR_PEER 'dbclient -i /etc/dropbear/dropbear_rsa_host_key')
   2.321 -      <hbox>
   2.322 -	$(startstopdaemon dropbear)
   2.323 -      </hbox>
   2.324 -     </frame>
   2.325 -EOT
   2.326 -}
   2.327 -
   2.328 -#
   2.329 -# OpenSSH client & server
   2.330 -#
   2.331 -tab_openssh()
   2.332 -{
   2.333 -cat <<EOT
   2.334 -    <frame OpenSSH>
   2.335 -$(helpdaemon sshd 80x30 OPENSSH_OPTIONS OPENSSH_OPTS 8 nohelp)
   2.336 -$(configfile /etc/ssh/sshd_config OPENSSH_CONF '5 sshd_config')
   2.337 -$(sshremote OPENSSH_PEER 'ssh -i /etc/ssh/ssh_host_rsa_key')
   2.338 -      <hbox>
   2.339 -	$(startstopdaemon openssh)
   2.340 -      </hbox>
   2.341 -     </frame>
   2.342 -EOT
   2.343 -}
   2.344 -
   2.345 -data_sshd()
   2.346 -{
   2.347 -cat <<EOT
   2.348 -dropbear    Dropbear      tab_dropbear
   2.349 -sshd        OpenSSH       tab_openssh
   2.350 -EOT
   2.351 -}
   2.352 -
   2.353 -#
   2.354 -# SSH tab
   2.355 -#
   2.356 -tab_sshd()
   2.357 -{
   2.358 -use_tab data_sshd
   2.359 -}
   2.360 -
   2.361 -#
   2.362 -# Busybox Inetd
   2.363 -#
   2.364 -tab_inetd()
   2.365 -{
   2.366 -cat <<EOT
   2.367 -<frame Inetd (busybox)>
   2.368 -$(helpdaemon inetd 60x14 INETD_OPTIONS INETD_OPTS)
   2.369 -$(configfile /etc/inetd.conf INETD_CONF)
   2.370 -      <hbox>
   2.371 -EOT
   2.372 -for i in $(grep bin /etc/inetd.conf | awk '{ print $6}'); do
   2.373 -  i=$(basename $i)
   2.374 -  helpbutton $i 60x19 $i
   2.375 -done
   2.376 -cat <<EOT
   2.377 -	$(startstopdaemon inetd)
   2.378 -      </hbox>
   2.379 -     </frame>
   2.380 -EOT
   2.381 -}
   2.382 -
   2.383 -#
   2.384 -# ZeroConf
   2.385 -#
   2.386 -tab_zcip()
   2.387 -{
   2.388 -if [ -x /sbin/zcip -a -z "$ZCIP_OPTIONS" ]; then
   2.389 -	ZCIP_OPTIONS="eth0 /etc/zcip.script"
   2.390 -	cat >> /etc/daemons.conf <<EOT
   2.391 -# ZeroConf options
   2.392 -ZCIP_OPTIONS="$ZCIP_OPTIONS"
   2.393 -
   2.394 -EOT
   2.395 -fi
   2.396 -cat <<EOT
   2.397 -     <frame Zcip (busybox)>
   2.398 -$(helpdaemon zcip 60x14 ZCIP_OPTIONS ZCIP_OPTS)
   2.399 -$(datafile /etc/zcip.script CZIP_SCRIPT 'Script :')
   2.400 -      <hbox>
   2.401 -	$(startstopdaemon zcip)
   2.402 -      </hbox>
   2.403 -     </frame>
   2.404 -EOT
   2.405 -}
   2.406 -
   2.407 -#
   2.408 -# Dhcpd ISC
   2.409 -#
   2.410 -tab_isc_dhcpd()
   2.411 -{
   2.412 -cat <<EOT
   2.413 -    <frame Dhcpd (ISC)>
   2.414 -$(helpdaemon dhcpd 60x14 DHCPD_OPTIONS DHCPD_OPTS)
   2.415 -$(configfile /etc/dhcpd.conf DHCPD_CONF)
   2.416 -      <hbox>
   2.417 -	$(startstopdaemon dhcpd dhcp)
   2.418 -      </hbox>
   2.419 -     </frame>
   2.420 -EOT
   2.421 -}
   2.422 -
   2.423 -#
   2.424 -# Dhcpd Busybox
   2.425 -#
   2.426 -tab_udhcpd()
   2.427 -{
   2.428 -cat <<EOT
   2.429 -    <frame Udhcpd (busybox)>
   2.430 -$(helpdaemon udhcpd 60x14 UDHCPD_OPTIONS UDHCPD_OPTS)
   2.431 -$(configfile /etc/udhcpd.conf UDHCPD_CONF)
   2.432 -      <hbox>
   2.433 -	$(startstopdaemon udhcpd busybox)
   2.434 -      </hbox>
   2.435 -     </frame>
   2.436 -EOT
   2.437 -}
   2.438 -
   2.439 -data_dhcpd()
   2.440 -{
   2.441 -cat <<EOT
   2.442 -udhcpd      Udhcpd        tab_udhcpd
   2.443 -dhcpd       Dhcpd         tab_isc_dhcpd
   2.444 -dnsmasq     DNSmasq       tab_dnsmasq
   2.445 -EOT
   2.446 -}
   2.447 -
   2.448 -#
   2.449 -# dhcpd tab
   2.450 -#
   2.451 -tab_dhcpd()
   2.452 -{
   2.453 -use_tab data_dhcpd
   2.454 -}
   2.455 -
   2.456 -#
   2.457 -# PXE forwarder
   2.458 -#
   2.459 -tab_gpxe()
   2.460 -{
   2.461 -cat <<EOT
   2.462 -<frame PXE forwarder>
   2.463 -      <hbox>
   2.464 -        <text use-markup="true">
   2.465 -          <label>"<b>WEB boot URL(s) :</b>"</label>
   2.466 -        </text>
   2.467 -      </hbox>
   2.468 -      <hbox>
   2.469 -        <entry editable="true">
   2.470 -          <default>
   2.471 -"$(dd bs=1 skip=5 count=255 if=/usr/share/boot/gpxe.pxe 2> /dev/null | strings)"
   2.472 -          </default>
   2.473 -          <variable>WEB_PXE</variable>
   2.474 -        </entry>
   2.475 -      </hbox>
   2.476 -      <hbox>
   2.477 -$(wikibutton http://wiki.slitaz.org/doku.php?id=quickstart:pxe)
   2.478 -        <button>
   2.479 -          <input file icon="go-jump"></input>
   2.480 -	  <label>Install</label>
   2.481 -	  <action>
   2.482 -	echo -n "\$WEB_PXE" | cat - /dev/zero | \
   2.483 -	dd conv=notrunc bs=1 seek=5 count=255 of=/usr/share/boot/gpxe.pxe
   2.484 -	  </action>
   2.485 -	  <action>
   2.486 -	sed -i "s|tftpd -r .*\$|tftpd -r /usr/share/boot|" /etc/inetd.conf
   2.487 -	  </action>
   2.488 -	  <action> sed -i "/^boot_file/d" \$UDHCPD_CONF </action>
   2.489 -	  <action> echo "boot_file gpxe.pxe" >> \$UDHCPD_CONF </action>
   2.490 -	  <action> /etc/init.d/inetd restart </action>
   2.491 -	  <action> /etc/init.d/udhcpd restart </action>
   2.492 -	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)inetd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   2.493 -	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)udhcpd \?\\(.*\\)\\"/RUN_DAEMONS=\\"\1\2\\"/" /etc/rcS.conf</action>
   2.494 -	<action>sed -i "s/RUN_DAEMONS=\\"\\(.*\\)\\"/RUN_DAEMONS=\\"udhcpd inetd \1\\"/" /etc/rcS.conf</action>
   2.495 -        </button>
   2.496 -      </hbox>
   2.497 -</frame>
   2.498 -EOT
   2.499 -}
   2.500 -
   2.501 -#
   2.502 -# PXE server
   2.503 -#
   2.504 -tab_pxelinux()
   2.505 -{
   2.506 -cat <<EOT
   2.507 -<frame PXElinux>
   2.508 -      <hbox>
   2.509 -        <text wrap="true">
   2.510 -          <label>
   2.511 -"Launch Dhcpd and Inetd with Tftpd to start the PXE service."
   2.512 -          </label>
   2.513 -        </text>
   2.514 -      </hbox>
   2.515 -      <hbox>
   2.516 -        <text use-markup="true">
   2.517 -          <label>"<b>Configuration :</b>"</label>
   2.518 -        </text>
   2.519 -        <entry editable="false">
   2.520 -          <default>
   2.521 -$(grep bin/tftpd /etc/inetd.conf | awk '{ print $NF }')/pxelinux.cfg/default
   2.522 -          </default>
   2.523 -          <variable>PXE_CONF</variable>
   2.524 -        </entry>
   2.525 -        <button>
   2.526 -          <input file icon="accessories-text-editor"></input>
   2.527 -	  <action>dir=\$(dirname \$PXE_CONF); [ -d \$dir ] || mkdir -p \$dir</action>
   2.528 -	  <action>lzma d /usr/share/boot/pxelinux.0.lzma \$(dirname \$PXE_CONF)/../pxelinux.0</action>
   2.529 -	  <action>sed -i "/^boot_file/d" \$UDHCPD_CONF</action>
   2.530 -	  <action>echo "boot_file pxelinux.0" >> \$UDHCPD_CONF</action>
   2.531 -	  <action>grep -q "^siaddr" \$UDHCPD_CONF || echo "siaddr \$(ifconfig \$INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\  -f1)" >> \$UDHCPD_CONF</action>
   2.532 -	  <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>
   2.533 -          <action type="lauch">leafpad \$PXE_CONF</action>
   2.534 -        </button>
   2.535 -      </hbox>
   2.536 -      <hbox>
   2.537 -$(wikibutton http://wiki.slitaz.org/doku.php?id=quickstart:pxe)
   2.538 -        <button>
   2.539 -          <input file icon="system-file-manager"></input>
   2.540 -	  <label>Network boot files</label>
   2.541 -	  <action>$xterm -geometry 100x25 -title "Network boot files (q to quit)" -e "find \$(dirname \$(dirname \$PXE_CONF)) -exec ls -ld {} \; | less"</action>
   2.542 -        </button>
   2.543 -      </hbox>
   2.544 -     </frame>
   2.545 -EOT
   2.546 -}
   2.547 -
   2.548 -data_pxe()
   2.549 -{
   2.550 -[ -f /usr/share/boot/pxelinux.0.lzma ] && cat <<EOT
   2.551 -true        PXElinux          tab_pxelinux
   2.552 -EOT
   2.553 -[ -f /usr/share/boot/gpxe.pxe ] && cat <<EOT
   2.554 -true        PXE\ forwarder    tab_gpxe
   2.555 -EOT
   2.556 -}
   2.557 -
   2.558 -#
   2.559 -# PXE
   2.560 -#
   2.561 -tab_pxe()
   2.562 -{
   2.563 -use_tab data_pxe
   2.564 -}
   2.565 -
   2.566 -#
   2.567 -# Busybox dnsd
   2.568 -#
   2.569 -tab_dnsd()
   2.570 -{
   2.571 -cat <<EOT
   2.572 -    <frame Dnsd (busybox master dns)>
   2.573 -$(helpdaemon dnsd 80x15 DNSD_OPTIONS DNSD_OPTS)
   2.574 -$(configfile /etc/dnsd.conf DNSD_CONF)
   2.575 -      <hbox>
   2.576 -	$(startstopdaemon dnsd busybox)
   2.577 -      </hbox>
   2.578 -     </frame>
   2.579 -EOT
   2.580 -}
   2.581 -
   2.582 -#
   2.583 -# ISC Bind
   2.584 -#
   2.585 -tab_named()
   2.586 -{
   2.587 -cat <<EOT
   2.588 -    <frame Named (ISC bind)>
   2.589 -$(helpdaemon named 80x10 NAMED_OPTIONS NAMED_OPTS)
   2.590 -$(configfile /etc/bind/named.conf.local NAMED_CONF)
   2.591 -      <hbox>
   2.592 -	$(startstopdaemon named bind)
   2.593 -      </hbox>
   2.594 -     </frame>
   2.595 -EOT
   2.596 -}
   2.597 -
   2.598 -#
   2.599 -# DNSmasq 
   2.600 -#
   2.601 -tab_dnsmasq()
   2.602 -{
   2.603 -cat <<EOT
   2.604 -    <frame DNSmasq (DNS/DHCP/TFTP)>
   2.605 -$(helpdaemon dnsmasq 100x34 DNSMASQ_OPTIONS DNSMASQ_OPTS)
   2.606 -$(configfile /etc/dnsmasq.conf DNSMASQ_CONF)
   2.607 -      <hbox>
   2.608 -	$(startstopdaemon dnsmasq)
   2.609 -      </hbox>
   2.610 -     </frame>
   2.611 -EOT
   2.612 -}
   2.613 -
   2.614 -data_dns()
   2.615 -{
   2.616 -cat <<EOT
   2.617 -dnsd        Dnsd          tab_dnsd
   2.618 -named       Named         tab_named
   2.619 -dnsmasq     DNSmasq       tab_dnsmasq
   2.620 -#TODO sheerdns    Sheerdns      tab_sheerdns
   2.621 -EOT
   2.622 -}
   2.623 -
   2.624 -#
   2.625 -# dns tab
   2.626 -#
   2.627 -tab_dns()
   2.628 -{
   2.629 -use_tab data_dns
   2.630 -}
   2.631 -
   2.632 -#
   2.633 -# rsync server
   2.634 -#
   2.635 -tab_rsync()
   2.636 -{
   2.637 -cat <<EOT
   2.638 -     <frame Rsync>
   2.639 -$(helpdaemon rsync 80x30 RSYNCD_OPTIONS RSYNCD_OPTS 1)
   2.640 -$(configfile /etc/rsyncd.conf RSYNCD_CONF)
   2.641 -$(datafile /etc/rsyncd.secrets RSYNCD_SECRETS 'Secrets file     :')
   2.642 -      <hbox>
   2.643 -	$(startstopdaemon rsyncd rsync)
   2.644 -      </hbox>
   2.645 -     </frame>
   2.646 -EOT
   2.647 -}
   2.648 -
   2.649 -php_ini()
   2.650 -{
   2.651 -[ -f /etc/php.ini ] && cat <<EOT
   2.652 -      <frame PHP>
   2.653 -$(configfile /etc/php.ini PHP_CONF)
   2.654 -      </frame>
   2.655 -EOT
   2.656 -}
   2.657 -
   2.658 -#
   2.659 -# Apache server
   2.660 -#
   2.661 -tab_apache()
   2.662 -{
   2.663 -cat <<EOT
   2.664 -     <frame Apache>
   2.665 -$(configfile /etc/apache/httpd.conf HTTPD_CONF)
   2.666 -$(php_ini)
   2.667 -      <hbox>
   2.668 -	$(startstopdaemon apache)
   2.669 -      </hbox>
   2.670 -     </frame>
   2.671 -EOT
   2.672 -}
   2.673 -
   2.674 -#
   2.675 -# Lighttpd server
   2.676 -#
   2.677 -tab_lighttpd()
   2.678 -{
   2.679 -cat <<EOT
   2.680 -     <frame Lighttpd>
   2.681 -$(helpdaemon lighttpd 80x15 LIGHTTPD_OPTIONS LIGHTTPD_OPTS)
   2.682 -$(configfile /etc/lighttpd/lighttpd.conf LIGHTTPD_CONF)
   2.683 -$(php_ini)
   2.684 -      <hbox>
   2.685 -	$(startstopdaemon lighttpd)
   2.686 -      </hbox>
   2.687 -     </frame>
   2.688 -EOT
   2.689 -}
   2.690 -
   2.691 -#
   2.692 -# Busybox httpd server
   2.693 -#
   2.694 -tab_httpd()
   2.695 -{
   2.696 -cat <<EOT
   2.697 -     <frame httpd (busybox)>
   2.698 -$(helpdaemon httpd 80x30 HTTPD_OPTIONS HTTPD_OPTS)
   2.699 -$(configfile /etc/httpd.conf HTTPD_CONF)
   2.700 -$(php_ini)
   2.701 -      <hbox>
   2.702 -	$(startstopdaemon httpd busybox)
   2.703 -      </hbox>
   2.704 -     </frame>
   2.705 -EOT
   2.706 -}
   2.707 -
   2.708 -data_http()
   2.709 -{
   2.710 -cat <<EOT
   2.711 -/etc/apache/httpd.conf  Apache          tab_apache
   2.712 -lighttpd                Lighttpd        tab_lighttpd
   2.713 -/etc/httpd.conf         Busybox\ httpd  tab_httpd
   2.714 -EOT
   2.715 -}
   2.716 -
   2.717 -#
   2.718 -# http tab
   2.719 -#
   2.720 -tab_http()
   2.721 -{
   2.722 -use_tab data_http
   2.723 -}
   2.724 -
   2.725 -#
   2.726 -# Samba servers
   2.727 -#
   2.728 -tab_wins()
   2.729 -{
   2.730 -cat <<EOT
   2.731 -     <frame Samba: smbd & nmbd>
   2.732 -$(configfile /etc/samba/smb.conf SMBD_CONF)
   2.733 -      <hbox>
   2.734 -        <button>
   2.735 -          <label>Reload</label>
   2.736 -          <input file icon="reload"></input>
   2.737 -          <action>/etc/init.d/samba reload</action>
   2.738 -        </button>
   2.739 -	$(startstopdaemon samba)
   2.740 -      </hbox>
   2.741 -     </frame>
   2.742 -EOT
   2.743 -}
   2.744 -
   2.745 -#
   2.746 -# x11vnc
   2.747 -#
   2.748 -tab_vnc()
   2.749 -{
   2.750 -cat <<EOT
   2.751 -     <frame x11vnc>
   2.752 -$(helpdaemon x11vnc 80x30 X11VNC_OPTIONS X11VNC_OPTS)
   2.753 -      <hbox>
   2.754 -        <text use-markup="true">
   2.755 -          <label>"<b>New password</b>"</label>
   2.756 -        </text>
   2.757 -        <entry>
   2.758 -          <variable>X11VNC_PASSWD</variable>
   2.759 -        </entry>
   2.760 -        <button>
   2.761 -          <input file icon="reload"></input>
   2.762 -          <label>Update</label>
   2.763 -          <action>x11vnc -storepasswd \$X11VNC_PASSWD /etc/vnc.secret</action>
   2.764 -        </button>
   2.765 -      </hbox>
   2.766 -      <hbox>
   2.767 -	$(startstopdaemon x11vnc)
   2.768 -      </hbox>
   2.769 -     </frame>
   2.770 -EOT
   2.771 -}
   2.772 -
   2.773 -#
   2.774 -# knock server
   2.775 -#
   2.776 -tab_knockd()
   2.777 -{
   2.778 -cat <<EOT
   2.779 -    <frame Knockd: trigger backdoors>
   2.780 -$(helpdaemon knockd 80x15 KNOCK_OPTIONS KNOCK_OPTS)
   2.781 -$(configfile /etc/knockd.conf KNOCKD_CONF)
   2.782 -      <hbox>
   2.783 -	$(startstopdaemon knockd knock)
   2.784 -      </hbox>
   2.785 -     </frame>
   2.786 -EOT
   2.787 -}
   2.788 -
   2.789 -data_servers()
   2.790 -{
   2.791 -local $pxe
   2.792 -pxe="#"
   2.793 -[ -x /usr/bin/tftpd -a -x /usr/sbin/udhcpd ] && pxe="inetd"
   2.794 -[ -x /usr/sbin/dnsmasq ] && pxe="true"
   2.795 -[ -f /usr/share/boot/pxelinux.0.lzma -o /usr/share/boot/gpxe.pxe ] || pxe="#"
   2.796 -cat <<EOT
   2.797 -$([ -x /usr/sbin/dropbear -o -x /usr/sbin/sshd ] && echo "true" ||
   2.798 -echo "#")   SSH           tab_sshd
   2.799 -inetd       Inetd         tab_inetd
   2.800 -zcip        ZeroConf      tab_zcip
   2.801 -$([ -x /usr/sbin/udhcpd -o -x /usr/sbin/dhcpd -o -x /usr/sbin/dnsmasq ] && 
   2.802 -echo "true" ||
   2.803 -echo "#")   DHCP          tab_dhcpd
   2.804 -$pxe        PXE           tab_pxe
   2.805 -dnsmasq     tftpd         tab_dnsmasq
   2.806 -$([ -x /usr/sbin/dnsd -o -x /usr/sbin/named -o -x /usr/sbin/dnsmasq ] && 
   2.807 -echo "true" ||
   2.808 -echo "#")   DNS           tab_dns
   2.809 -rsync       Rsync         tab_rsync
   2.810 -$([ -x /usr/sbin/lighttpd -o -x /usr/bin/httpd ] && echo "true" || 
   2.811 -echo "#")   HTTP          tab_http
   2.812 -smbd        WINS          tab_wins
   2.813 -x11vnc      VNC           tab_vnc 
   2.814 -knockd      Knock         tab_knockd
   2.815 -#TODO+callback pppd        Pppd          tab_pppd
   2.816 -#TODO pptpd       PoPToP        tab_poptop
   2.817 -#TODO squid *sql openldap 
   2.818 -EOT
   2.819 -}
   2.820 -
   2.821 -#
   2.822 -# Servers tab
   2.823 -#
   2.824 -tab_servers()
   2.825 -{
   2.826 -use_tab data_servers
   2.827 -}
   2.828 -
   2.829 -#
   2.830 -# Firewall tab
   2.831 -#
   2.832 -tab_firewall()
   2.833 -{
   2.834 -cat <<EOT
   2.835 -    <frame Iptables>
   2.836 -$(configfile /etc/iptables.conf IPTABLES_CONF)
   2.837 -      <hbox>
   2.838 -$(helpbutton iptables 80x30)
   2.839 -$(manbutton 8 iptables)
   2.840 -$(webbutton iptables)
   2.841 -        <button>
   2.842 -          <label>Load</label>
   2.843 -          <input file icon="reload"></input>
   2.844 -          <action>cat \$IPTABLES_CONF | /sbin/iptables-restore</action>
   2.845 -        </button>
   2.846 -        <button>
   2.847 -          <label>Save</label>
   2.848 -          <input file icon="go-jump"></input>
   2.849 -          <action>/sbin/iptables-save > \$IPTABLES_CONF</action>
   2.850 -        </button>
   2.851 -      </hbox>
   2.852 -     </frame>
   2.853 -EOT
   2.854 -}
   2.855 -
   2.856 -#
   2.857 -# knock client
   2.858 -#
   2.859 -tab_knock()
   2.860 -{
   2.861 -cat <<EOT
   2.862 -    <frame Knock>
   2.863 -    <hbox>
   2.864 -      <text use-markup="true">
   2.865 -        <label>"<b>Options : </b>"</label>
   2.866 -      </text>
   2.867 -      <entry editable="true">
   2.868 -        <variable>KNOCK_OPTS</variable>
   2.869 -	<default>myserver.example.com 123:tcp 456:udp 789:tcp</default>
   2.870 -      </entry>
   2.871 -    </hbox>
   2.872 -    <hbox>
   2.873 -$(helpbutton knock 80x12)
   2.874 -      <button>
   2.875 -        <label>Start</label>
   2.876 -        <input file icon="forward"></input>
   2.877 -        <action>knock \$KNOCK_OPTS</action>
   2.878 -      </button>
   2.879 -    </hbox>
   2.880 -    </frame>
   2.881 -EOT
   2.882 -}
   2.883 -
   2.884  #
   2.885  # ether-wake
   2.886  #
   2.887 @@ -1773,12 +947,9 @@
   2.888  ifconfig    Static\ IP    tab_fixed_ip
   2.889  pppoe       PPPoE         tab_pppoe
   2.890  pppd        PPP           tab_ppp
   2.891 -true        System\ wide  tab_system
   2.892  true        VPN           tab_vpn
   2.893 -true        Servers       tab_servers
   2.894 -iptables    Firewall      tab_firewall
   2.895 -knock       Knock         tab_knock
   2.896  ether-wake  Etherwake     tab_etherwake
   2.897 +true        Configuration tab_system
   2.898  EOT
   2.899  }
   2.900  
   2.901 @@ -1851,7 +1022,7 @@
   2.902  
   2.903  		<hbox>
   2.904  			<text use-markup="true">
   2.905 -				<label>"<b>Network/Server Manager</b>"</label>
   2.906 +				<label>"<b>Network Manager</b>"</label>
   2.907  			</text>
   2.908  			<pixmap>
   2.909  				<input file>/usr/share/pixmaps/netbox.png</input>