summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-10-12 00:24:05 -0400
committerAndrew Cady <d@jerkface.net>2019-10-12 00:24:05 -0400
commit308f2b8b8d049c702706cbc34df5f3d3b15afad9 (patch)
tree088640d61b49caa0ce525ffb9b2523cca598c5fe
parent45556aef4dcc1ae78bbe68bc4842703d26f4763a (diff)
add support for specifying ssh port
-rwxr-xr-xdot/local/bin/xvnc19
1 files changed, 15 insertions, 4 deletions
diff --git a/dot/local/bin/xvnc b/dot/local/bin/xvnc
index 9bc982b..7c0159c 100755
--- a/dot/local/bin/xvnc
+++ b/dot/local/bin/xvnc
@@ -4,7 +4,10 @@ direct_connection()
4{ 4{
5 port=$((5900 + local_display)) 5 port=$((5900 + local_display))
6 ssh -o ControlPath=none -n \ 6 ssh -o ControlPath=none -n \
7 -L $port:localhost:$port "$remote_host" "x11vnc -nopw -ncache -ncache_cr -localhost -display ${remote_display}" & 7 -L $port:localhost:$port \
8 ${remote_port+-p $remote_port} \
9 "$remote_host" \
10 "x11vnc -nopw -ncache -ncache_cr -localhost -display ${remote_display}" &
8 pid=$! 11 pid=$!
9 sleep 1 # surrender race 12 sleep 1 # surrender race
10 xvncviewer -encodings "copyrect tight zrle hextile" localhost:0 13 xvncviewer -encodings "copyrect tight zrle hextile" localhost:0
@@ -13,7 +16,7 @@ direct_connection()
13 16
14quietly() 17quietly()
15{ 18{
16 "$@" >/dev/null 2>&1 19 "$@" # >/dev/null 2>&1
17} 20}
18 21
19reverse_connection() 22reverse_connection()
@@ -22,7 +25,9 @@ reverse_connection()
22 xvncviewer -fullscreen -encodings "copyrect tight zrle hextile" -listen & 25 xvncviewer -fullscreen -encodings "copyrect tight zrle hextile" -listen &
23 pid=$! 26 pid=$!
24 quietly ssh -o ControlPath=none \ 27 quietly ssh -o ControlPath=none \
25 -R $port:localhost:$port "$remote_host" \ 28 -R $port:localhost:$port \
29 ${remote_port+-p $remote_port} \
30 "$remote_host" \
26 "x11vnc -q -nopw -localhost -display ${remote_display} -coe localhost:$port -rfbport 0" 31 "x11vnc -q -nopw -localhost -display ${remote_display} -coe localhost:$port -rfbport 0"
27 kill $pid 32 kill $pid
28} 33}
@@ -35,7 +40,9 @@ share_display()
35 ssh -o ControlPath=none \ 40 ssh -o ControlPath=none \
36 -o ExitOnForwardFailure=yes \ 41 -o ExitOnForwardFailure=yes \
37 -f \ 42 -f \
38 -L $port:localhost:$port "$remote_host" \ 43 -L $port:localhost:$port \
44 ${remote_port+-p $remote_port} \
45 "$remote_host" \
39 "fuser -vk $port/tcp; DISPLAY=${remote_display} xvncviewer -fullscreen -encodings 'copyrect tight zrle hextile' -listen" 46 "fuser -vk $port/tcp; DISPLAY=${remote_display} xvncviewer -fullscreen -encodings 'copyrect tight zrle hextile' -listen"
40 trap "fuser -vk $port/tcp" INT 47 trap "fuser -vk $port/tcp" INT
41 sleep 1 48 sleep 1
@@ -51,6 +58,10 @@ else
51fi 58fi
52 59
53remote_host=${1:-blackboard} 60remote_host=${1:-blackboard}
61
62remote_port=${remote_host##*:}
63remote_host=${remote_host%:*}
64
54remote_display=${2:-:0} 65remote_display=${2:-:0}
55local_display=${3:-:0} 66local_display=${3:-:0}
56 67