#!/bin/bash set -e set -o pipefail # x11vnc option '-noxrecord' added as workaround for crashing bug # See https://github.com/LibVNC/x11vnc/issues/61 # # The option is not be needed with latest x11vnc from source, but we don't rely # on the remote side being up to date. ssh() { command ssh "$@" 2>&1 | sed 's/^/REMOTE> /' } direct_connection() { rando=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c15) && [ "$rando" ] remote_socket_file=/tmp/x11vnc.$rando.socket port=$((5500 + $(tr -dc 1-9 /dev/null || true set +e set -- "$X11VNC" "$SSH" ps hu "$@" kill "$@" rm -rf "$OUR_TMP" } share_display() { if [ "$DEBUG" ] then set -x fi port=$((5500 + $(tr -dc 1-9