From a124b2193655dfaa57ca77f112866ded067ce3fc Mon Sep 17 00:00:00 2001
From: Mathis Rosenhauer <rosenhauer@dkrz.de>
Date: Wed, 27 Sep 2017 17:25:22 +0200
Subject: [PATCH] Look for vncviewer in search path by default

---
 startvnc | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/startvnc b/startvnc
index 2d883a5..2a9ade0 100755
--- a/startvnc
+++ b/startvnc
@@ -54,8 +54,8 @@ set -eu
 # You can change the settings here or override them with command line
 # options. SVNC_ACCTCODE is the only parameter you have to provide if
 # your local username matches your username on the frontend and if
-# vncviewer is installed in the standard location (tight/tigervnc on
-# Linux for example).
+# vncviewer is installed in the search path (tight/tigervnc on Linux
+# for example).
 
 # Project account code
 SVNC_ACCTCODE=""
@@ -68,10 +68,9 @@ SVNC_USERNAME=$(id -un)
 
 # Path to local vncviewer
 #
-# On Linux and other Unix systems chances are that vncviewer is
-# installed in /usr/bin. If this is not the case, e.g. if you use
-# TurboVNC or if you are on macOS, then change this parameter.
-SVNC_VNCVIEWER="/usr/bin/vncviewer"
+# If your local vnc client is not in the search path or named
+# differently (e.g. TurboVNC, macOS), then change this parameter.
+SVNC_VNCVIEWER="vncviewer"
 
 # Resolution of remote desktop window
 #
@@ -113,13 +112,13 @@ clean_up () {
     set +e
 
     if [[ -n ${vnc_host:-} ]]; then
-    echo "Killing vncserver :${vnc_display} on ${vnc_host}."
+        echo "Killing vncserver :${vnc_display} on ${vnc_host}."
         ssh_frontend "ssh ${vnc_host} \"/opt/TurboVNC/bin/vncserver \
                      -kill :${vnc_display}\""
     fi
 
     if [[ -n ${job_id:-} ]]; then
-    echo "Removing job ${job_id}."
+        echo "Removing job ${job_id}."
         ssh_frontend "scancel -Q ${job_id}; sleep 1; \
                      cd .startvnc && rm -f out.${job_id}"
     else
@@ -252,7 +251,7 @@ main () {
     local vnc_options="${SVNC_VNC_OPTIONS:-} \
                        -via ${SVNC_USERNAME}@${vnc_host}.dkrz.de"
     if [[ ${SVNC_PASSWORD} = "true" ]]; then
-    echo "Fetching password from frontend."
+        echo "Fetching password from frontend."
         ssh_frontend "cat .vnc/passwd" > ${HOME}/vnc_passwd
         vnc_options+=" -passwd ${HOME}/vnc_passwd"
     fi
-- 
GitLab