diff options
author | Dirk von Suchodoletz | 2009-09-09 19:11:12 +0200 |
---|---|---|
committer | Dirk von Suchodoletz | 2009-09-09 19:11:12 +0200 |
commit | 8ad93a320e384078e192e04d3a2ed53d0f706e23 (patch) | |
tree | 9089ba58f896b811b88d1e1802ebff3676dcf652 /os-plugins/plugins/pvs/files/pvs-vncsrv | |
parent | integrated firmware copy process into kernel module process, deleted unused a... (diff) | |
download | core-8ad93a320e384078e192e04d3a2ed53d0f706e23.tar.gz core-8ad93a320e384078e192e04d3a2ed53d0f706e23.tar.xz core-8ad93a320e384078e192e04d3a2ed53d0f706e23.zip |
Plugin to include pvs stuff more formally (do not use it yet!) ...
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@3148 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/pvs/files/pvs-vncsrv')
-rwxr-xr-x | os-plugins/plugins/pvs/files/pvs-vncsrv | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/os-plugins/plugins/pvs/files/pvs-vncsrv b/os-plugins/plugins/pvs/files/pvs-vncsrv new file mode 100755 index 00000000..cdffbc82 --- /dev/null +++ b/os-plugins/plugins/pvs/files/pvs-vncsrv @@ -0,0 +1,104 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Copyright (c) 2009 - RZ Uni FR +# Copyright (c) 2009 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# pvs-vncsrv +# - This is a generic wrapper script for starting any userspace VNC server +# to offer connectivity from the pvs contol console. The script expects +# start/stop in $1, the port to start on in $2 and the password in $3. The +# latter one should be changed to piping for security reasons ... +# ----------------------------------------------------------------------------- + +# parameters for x11vnc +X11VNC_PARAMS="-bg -forever -display :0 -passwdfile rm:~/.pvs/vncpasswd -o /var/log/x11vnc.log -shared" +X11VNC_X11="1" + +# at the moment the poolVSClient is expected to use the ~/.pvs directory +[ -d ~/.pvs ] || mkdir ~/.pvs + +# write the password file +echo -e "$3\n__BEGIN_VIEWONLY__\n$3" > ~/.pvs/vncpasswd + +# find xauthority file +find_xauth () { + FOUND=0 + RETRIES=4 + [ -z "$1" ] || RETRIES="$1" + + [ -e "/var/lib/kdm/" ] && + XAUTHFILE_KDM=`find /var/lib/kdm/ -iname "A\:0-*"` + [ -e "/var/run/xauth/" ] && + XAUTHFILE_KDM2=$(find /var/run/xauth/ -iname "A\:0-*") + [ -e "/var/lib/xdm/authdir/authfiles/" ] && + XAUTHFILE_XDM=$(find /var/lib/xdm/authdir/authfiles/ -iname "A\:0-*") + [ -e "/var/lib/gdm/" ] && + XAUTHFILE_GDM=$(find /var/lib/gdm/ -iname *Xauth*) + + [ -f "$XAUTHFILE_KDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM" + [ -f "$XAUTHFILE_KDM2" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM2" + [ -f "$XAUTHFILE_XDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_XDM" + [ -f "$XAUTHFILE_GDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_GDM" + + if [ "$FOUND" -eq "0" ]; then + if [ "$RETRIES" -gt "0" ]; then + let "RETRIES-=1" + find_xauth "$RETRIES" + else + echo "start FAILED (can't find way to authenticate myself against X)" \ + >>~/.pvs/log.vncsrv + exit -1 + fi + else + echo "found authfile ($XAUTHORITY)" >>~/.pvs/log.vncsrv + fi +} + +START_COMMAND="x11vnc" + +case "$1" in + start) + [ -z "$2" -o -z "$3" ] && echo " Port and/or Password not set" \ + >>~/.pvs/log.vncsrv + if [ ! -f ~/.pvs/vncpasswd ]; then + echo " Start FAILED (~/.pvs/vncpasswd not found)" >>~/.pvs/log.vncsrv + echo " Create it manualy and retry starting x11vnc" >>~/.pvs/log.vncsrv + exit -1; + fi + + if [ $X11VNC_X11 = 1 ]; then + find_xauth + START_COMMAND="$START_COMMAND -auth $XAUTHORITY $X11VNC_PARAMS" + else + START_COMMAND="$START_COMMAND $X11VNC_PARAMS" + fi + OUTPUT=$($START_COMMAND) + echo "$START_COMMAND" >>~/.pvs/log.vncsrv + echo "$OUTPUT" >>~/.pvs/log.vncsrv + ;; + stop) + pid=$(pidof x11vnc) + if [ -z "$pid" ] + then + echo "x11vnc not running" >>~/.pvs/log.vncsrv + exit -1; + else + kill -9 $pid + echo "x11vnc stopped" >>~/.pvs/log.vncsrv + fi + ;; + *) + echo "x11vnc startscript" + echo "Usage: $0 (start|stop)" + ;; +esac +exit 0 + |