diff options
author | Gordon GECOS <u@adam> | 2023-05-31 20:54:19 -0400 |
---|---|---|
committer | Gordon GECOS <u@adam> | 2023-05-31 20:54:19 -0400 |
commit | c0a0041f01536a968584234a65e2140ad4f76343 (patch) | |
tree | 5f5fef3325390d5027f79fed33caade6a02d56c8 |
old changes
-rwxr-xr-x | xvnc | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ | |||
1 | #!/bin/sh | ||
2 | remote_display=0 | ||
3 | reverse_connection() | ||
4 | { | ||
5 | display=${DISPLAY#:} | ||
6 | display=${display%.*} | ||
7 | remote_port=$((58000 + remote_display)) | ||
8 | |||
9 | local_port=$((59000 + display)) | ||
10 | xvncviewer -listen $((local_port - 5500)) & | ||
11 | ssh "$@" -f -R "localhost:$remote_port:localhost:$local_port" -- \ | ||
12 | x11vnc -q -connect_or_exit localhost:$remote_port -display :$remote_display | ||
13 | } | ||
14 | |||
15 | direct_connection() | ||
16 | { | ||
17 | export VNC_VIA_CMD=": '%G'; ssh -f -L %L:%H:%R $* -- x11vnc -localhost -q -display $remote_display" | ||
18 | xvncviewer -via remote localhost | ||
19 | } | ||
20 | |||
21 | if [ $# = 0 ] | ||
22 | then | ||
23 | set -- -4 ella@blackboard | ||
24 | fi | ||
25 | |||
26 | REVERSE=y | ||
27 | if [ "$REVERSE" ] | ||
28 | then | ||
29 | reverse_connection "$@" | ||
30 | else | ||
31 | direct_connection "$@" | ||
32 | fi | ||