slitaz-tools rev 163

Netbox: add VNC
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 01 15:16:33 2008 +0000 (2008-05-01)
parents b94d06e67f34
children 055ada1bb408
files tinyutils/netbox
line diff
     1.1 --- a/tinyutils/netbox	Thu Apr 24 20:30:08 2008 +0200
     1.2 +++ b/tinyutils/netbox	Thu May 01 15:16:33 2008 +0000
     1.3 @@ -42,7 +42,7 @@
     1.4      </text>
     1.5      <frame Servers>
     1.6        <text wrap="false" width-chars="58">
     1.7 -        <input>for i in dropbear inetd udhcpd dnsd rsync lighttpd ; do ps w | grep $i | grep -v grep; done</input>
     1.8 +        <input>for i in dropbear inetd udhcpd dnsd rsync lighttpd smbd nmbd x11vnc; do ps w | grep $i | grep -v grep; done</input>
     1.9        </text>
    1.10      </frame>
    1.11      <hbox>
    1.12 @@ -252,7 +252,8 @@
    1.13  [ -x /usr/sbin/dnsd     ] && NET_BOX="${NET_BOX}${tmp}DNS"   && tmp='|' 
    1.14  [ -x /usr/bin/rsync     ] && NET_BOX="${NET_BOX}${tmp}RSYNC" && tmp='|' 
    1.15  [ -x /usr/sbin/lighttpd ] && NET_BOX="${NET_BOX}${tmp}HTTP"  && tmp='|' 
    1.16 -[ -x /usr/sbin/smbd     ] && NET_BOX="${NET_BOX}${tmp}WINS" && tmp='|' 
    1.17 +[ -x /usr/sbin/smbd     ] && NET_BOX="${NET_BOX}${tmp}WINS"  && tmp='|' 
    1.18 +[ -x /usr/bin/x11vnc    ] && NET_BOX="${NET_BOX}${tmp}VNC"   && tmp='|' 
    1.19  . /etc/daemons.conf
    1.20  set -- $DROPBEAR_OPTIONS
    1.21  while [ -n "$2" ]; do
    1.22 @@ -448,8 +449,8 @@
    1.23  	  <action>dir=$(dirname $PXE_CONF); [ -d $dir ] || mkdir -p $dir</action>
    1.24  	  <action>lzma d /usr/share/boot/pxelinux.0.lzma $(dirname $PXE_CONF)/../pxelinux.0</action>
    1.25  	  <action>grep -q "^boot_file" $UDHCPD_CONF || echo "boot_file pxelinux.0" >> $UDHCPD_CONF</action>
    1.26 -	  <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -d\  -f1)" >> $UDHCPD_CONF</action>
    1.27 -	  <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>
    1.28 +	  <action>grep -q "^siaddr" $UDHCPD_CONF || echo "siaddr $(ifconfig $INTERFACE | grep inet.ad | cut -d: -f2 | cut -c -15)" >> $UDHCPD_CONF</action>
    1.29 +	  <action>[ -f $PXE_CONF ] || echo -e "label slitaz\n\tkernel bzImage\n\tappend initrd=rootfs.gz rw root=/dev/null vga=normal" > $PXE_CONF</action>
    1.30            <action type="lauch">leafpad $PXE_CONF</action>
    1.31          </button>
    1.32        </hbox>
    1.33 @@ -627,18 +628,68 @@
    1.34            <input file icon="forward"></input>
    1.35            <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
    1.36            <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"samba \1\"/" /etc/rcS.conf</action>
    1.37 -          <action>/etc/init.d/lighttpd start</action>
    1.38 +          <action>/etc/init.d/samba start</action>
    1.39          </button>
    1.40          <button>
    1.41            <label>Stop</label>
    1.42            <input file icon="stop"></input>
    1.43            <action>sed -i "s/RUN_DAEMONS=\"\(.*\)samba \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
    1.44 -          <action>/etc/init.d/lighttpd stop</action>
    1.45 +          <action>/etc/init.d/samba stop</action>
    1.46          </button>
    1.47        </hbox>
    1.48       </frame>
    1.49  '
    1.50  [ -x /usr/sbin/smbd     ] && NET_BOX="${NET_BOX}${tmp}"
    1.51 +tmp='<frame x11vnc>
    1.52 +      <hbox>
    1.53 +        <text use-markup="true">
    1.54 +          <label>"<b>X11VNC_OPTIONS</b>"</label>
    1.55 +        </text>
    1.56 +        <entry editable="false">'
    1.57 +[ -n "$X11VNC_OPTIONS" ] && tmp="$tmp<default>$X11VNC_OPTIONS</default>"
    1.58 +tmp2='
    1.59 +          <variable>X11VNC_OPTS</variable>
    1.60 +        </entry>
    1.61 +        <button>
    1.62 +          <input file icon="help"></input>
    1.63 +	  <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x30 -title "x11vnc daemon help (q to quit)" -e "x11vnc --help | less"</action>
    1.64 +        </button>
    1.65 +        <button>
    1.66 +          <input file icon="accessories-text-editor"></input>
    1.67 +          <action type="lauch">leafpad /etc/daemons.conf</action>
    1.68 +        </button>
    1.69 +      </hbox>
    1.70 +      <hbox>
    1.71 +        <text use-markup="true">
    1.72 +          <label>"<b>New password</b>"</label>
    1.73 +        </text>
    1.74 +        <entry>
    1.75 +          <variable>X11VNC_PASSWD</variable>
    1.76 +        </entry>
    1.77 +        <button>
    1.78 +          <input file icon="reload"></input>
    1.79 +          <label>Update</label>
    1.80 +          <action>x11vnc -storepasswd $X11VNC_PASSWD /etc/vnc.secret</action>
    1.81 +        </button>
    1.82 +      </hbox>
    1.83 +      <hbox>
    1.84 +        <button>
    1.85 +          <label>Start</label>
    1.86 +          <input file icon="forward"></input>
    1.87 +          <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
    1.88 +          <action>sed -i "s/RUN_DAEMONS=\"\(.*\)\"/RUN_DAEMONS=\"x11vnc \1\"/" /etc/rcS.conf</action>
    1.89 +          <action>/etc/init.d/x11vnc start</action>
    1.90 +        </button>
    1.91 +        <button>
    1.92 +          <label>Stop</label>
    1.93 +          <input file icon="stop"></input>
    1.94 +          <action>sed -i "s/RUN_DAEMONS=\"\(.*\)x11vnc \?\(.*\)\"/RUN_DAEMONS=\"\1\2\"/" /etc/rcS.conf</action>
    1.95 +          <action>/etc/init.d/x11vnc stop</action>
    1.96 +        </button>
    1.97 +      </hbox>
    1.98 +     </frame>
    1.99 +'
   1.100 +[ -x /usr/bin/x11vnc    ] && NET_BOX="${NET_BOX}${tmp}${tmp2}"
   1.101  NET_BOX="${NET_BOX}
   1.102      </notebook>
   1.103  "
   1.104 @@ -726,8 +777,7 @@
   1.105  
   1.106  export NET_BOX
   1.107  
   1.108 -# TODO: Servers/VNC(X11vnc)
   1.109 -# Modules(Network kernel modules) VPN(OpenVPN)
   1.110 +# TODO:  Modules(Network kernel modules) VPN(OpenVPN)
   1.111  
   1.112  # Only root can configure network.
   1.113  check_root