]> gitweb.fluxo.info Git - scripts.git/commitdiff
VNC: support for a default server
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 11 Mar 2019 18:07:37 +0000 (15:07 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 11 Mar 2019 18:07:37 +0000 (15:07 -0300)
vnc

diff --git a/vnc b/vnc
index 527b785791d4f8a1f8f212f7ae7bfd32e5e4f97b..2b190f7e1553b48a0bf00dfa3fcfb6be6756ccca 100755 (executable)
--- a/vnc
+++ b/vnc
@@ -16,9 +16,13 @@ REMOTEPORT="${3:-5901}"
 VIEWER_OPTS="-AcceptClipboard=off -SendClipboard=off -SetPrimary=off -SendPrimary=off"
 
 # Check
-if [ -x "$SERVER" ]; then
-  echo "usage: $BASENAME <server> [localport] [remoteport]"
-  exit 1
+if [ -z "$SERVER" ]; then
+  if [ -h "$HOME/.vnc/default.passwd" ]; then
+    SERVER="$(basename `readlink $HOME/.vnc/default.passwd` .passwd)"
+  else
+    echo "usage: $BASENAME <server> [localport] [remoteport]"
+    exit 1
+  fi
 fi
 
 # Check if vncserver is running in the remote server and start otherwise