diff options
-rwxr-xr-x | core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver b/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver index de244d9a..40c8d61d 100755 --- a/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver +++ b/core/modules/remote-access/data/etc/X11/Xsetup.d/50-launch-vncserver @@ -23,10 +23,16 @@ passwd="$( < /dev/urandom tr -c -d 'a-zA-Z0-9#&/=()[]{}' | dd bs=8 count=1 status=none )" printf "%s" "$passwd" > "/tmp/vnc-passwd" url="http://${SLX_PXE_SERVER_IP}/slx-admin/api.php?do=remoteaccess" - curl -L --retry 4 --retry-connrefused --max-time 3 --retry-max-time 10 \ - --data-urlencode "password=$passwd" "$url" - killall x11vnc + curl -s -S -L --retry 4 --retry-connrefused --max-time 3 --retry-max-time 10 \ + --data-urlencode "password=$passwd" "$url" > /dev/null ( + # Make a copy of xauth, so if the xserver restarts, we'll use the old one and fail to connect + if [ -n "$XAUTHORITY" ]; then + copy="$( mktemp )" + cat "$XAUTHORITY" > "$copy" + export XAUTHORITY="$copy" + trap 'rm -f -- "$copy"' EXIT INT TERM + fi fails=0 while true; do s="$( date +%s )" |