summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/x11vnc/files/x11vnc
diff options
context:
space:
mode:
authorSebastian Schmelzer2008-03-13 11:20:44 +0100
committerSebastian Schmelzer2008-03-13 11:20:44 +0100
commita80b581d041872ab0407a3133e2f49af65f0adef (patch)
treedc08bad4daaebc7bd735bbf71aedf62f3466f5c6 /os-plugins/plugins/x11vnc/files/x11vnc
parent* added support for new action 'list-selections' which shows the available (diff)
downloadcore-a80b581d041872ab0407a3133e2f49af65f0adef.tar.gz
core-a80b581d041872ab0407a3133e2f49af65f0adef.tar.xz
core-a80b581d041872ab0407a3133e2f49af65f0adef.zip
* fixed suse problems with autoprobing Xauthority files
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1629 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/x11vnc/files/x11vnc')
-rwxr-xr-xos-plugins/plugins/x11vnc/files/x11vnc38
1 files changed, 24 insertions, 14 deletions
diff --git a/os-plugins/plugins/x11vnc/files/x11vnc b/os-plugins/plugins/x11vnc/files/x11vnc
index f51ce83b..81be80de 100755
--- a/os-plugins/plugins/x11vnc/files/x11vnc
+++ b/os-plugins/plugins/x11vnc/files/x11vnc
@@ -10,21 +10,31 @@ fi
# find xauthority file
find_xauth () {
- TIMEOUT=5
- XPID=`pidof X`
- XRUNNING=$?
- while [ "$XRUNNING" -ne "0" -a "$TIMEOUT" -gt "0" ]
- do
- echo -n "."
- sleep 1
- let "TIMEOUT-=1"
- XPID=`pidof X`
- XRUNNING=$?
- done
- if [ "$XRUNNING" -eq "0" ]; then
- XAUTHORITY=`ps ex|grep bin/X|sed -e "s/ /\n/g"|grep "^XAUTHORITY"|sed -e "s/XAUTHORITY=//"`
+ FOUND=0
+ RETRIES=4
+ [ -z "$1" ] && RETRIES="$1"
+
+ [ -e "/var/lib/kdm/" ] &&
+ XAUTHFILE_KDM=`find /var/lib/kdm/ -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_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 " .. FAILED (can't find way to authenticate myself against X)"
+ exit -1
+ fi
else
- echo " .. FAILED (no running X found)"
+ echo "found ($XAUTHORITY)"
fi
}