#!/bin/sh # 5_configure # # Configures TightVNC for either, launching at boot-time (with Java client) # or via inetd (without Java client). # # Lytle David Smith # http://david.computerlandinc.com echo "This procedure does not allow inetd launching of VNC to co-exist" echo "with the VNC Java client." echo "\nWhich is more important to you, inetd or the Java client [i/j/Q to quit]? \c" read confirm junk case ${confirm} in i|I) echo "\nDisabling any running VNC servers (may require manual reboot) ... \c" /etc/init.d/vncserver stop >/dev/null 2>&1 echo "Done." echo "Removing files/directories not required by inetd installation ... \c" rm -r /.vnc >/dev/null 2>&1 rm -r /etc/rc2.d/S99vncserver >/dev/null 2>&1 echo "Done." echo "Modifying /etc/services ... \c" ( echo "g/^vnc/d" echo "$" echo "a" echo "vnc\t5901/tcp" echo "." echo "w" echo "q" ) | ed -s /etc/services >/dev/null 2>&1 echo "Done." echo "Modifying /etc/inetd.conf ... \c" ( echo "g/^vnc/d" echo "$" echo "a" echo "vnc\tstream\ttcp\tnowait\tNOLUID\t/usr/local/bin/Xvnc Xvnc -inetd -query scosysv -once -geometry 1024x768 -depth 16" echo "." echo "w" echo "q" ) | ed -s /etc/inetd.conf >/dev/null 2>&1 echo "Done." echo "Disable GUI on console [y/N]? \c" read confirm junk if [ "${confirm}" = "y" -o "${confirm}" = "Y" ] then echo "Disabling console GUI ... \c" scologin disable >/dev/null 2>&1 ( echo "g/^:0/s/^/#/" echo "w" echo "q" ) | ed -s /usr/lib/X11/scologin/Xservers >/dev/null 2>&1 echo "Done." fi echo "Forcing inetd to re-read /etc/inetd.conf ... \c" kill -1 `cat /etc/inetd.pid` echo "Done." echo "Enabling GUI environment ... \c" scologin enable >/dev/null 2>&1 echo "Done." ;; j|J) echo "\nModifying /etc/services to disable vnc ... \c" ( echo "g/^vnc/d" echo "w" echo "q" ) | ed -s /etc/services >/dev/null 2>&1 echo "Done." echo "Modifying /etc/inetd.conf to disable vnc ... \c" ( echo "g/^vnc/d" echo "w" echo "q" ) | ed -s /etc/inetd.conf >/dev/null 2>&1 echo "Done." echo "Recreating /.vnc directory ... \c" rm -r /.vnc >/dev/null 2>&1 mkdir /.vnc ( echo "PATH=$PATH:/usr/bin/X11 ; export PATH" echo "[ -f $HOME/.Xresources ] && xrdb $HOME/.Xresources" echo "scosession &" ) | cat - >/.vnc/xstartup chmod 755 /.vnc/xstartup echo "Done." echo "\nPlease enter the password to be used to connect to VNC --" /usr/local/bin/vncpasswd echo "\nCreating /etc/rc2.d/S99vncserver script ... \c" rm /etc/rc2.d/S99vncserver >/dev/null 2>&1 ( echo ":" echo "HOME=/" echo "export HOME" echo "\nrm -r /tmp/.X11-unix >/dev/null 2>&1" echo "\n/etc/init.d/vncserver start" ) | cat - >/etc/rc2.d/S99vncserver chmod 755 /etc/rc2.d/S99vncserver echo "Done." ;; esac