forked from Synthetixio/docker-e2e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-vnc.sh
executable file
·42 lines (37 loc) · 1.05 KB
/
start-vnc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
if [ "${START_XVFB:-$SE_START_XVFB}" = true ] ; then
# Centering wallpaper
for i in $(seq 1 10)
do
sleep 0.5
echo "Centering wallpaper"
/usr/bin/fbsetbg -c /usr/share/images/fluxbox/ubuntu-light.png
if [ $? -eq 0 ]; then
break
fi
done
VNC_NO_PASSWORD=${VNC_NO_PASSWORD:-$SE_VNC_NO_PASSWORD}
if [ ! -z $VNC_NO_PASSWORD ]; then
echo "Starting VNC server without password authentication"
X11VNC_OPTS=
else
X11VNC_OPTS=-usepw
fi
VNC_VIEW_ONLY=${VNC_VIEW_ONLY:-$SE_VNC_VIEW_ONLY}
if [ ! -z $VNC_VIEW_ONLY ]; then
echo "Starting VNC server with viewonly option"
X11VNC_OPTS="${X11VNC_OPTS} -viewonly"
fi
for i in $(seq 1 10)
do
sleep 1
xdpyinfo -display :99.0 >/dev/null 2>&1
if [ $? -eq 0 ]; then
break
fi
echo "Waiting for Xvfb..."
done
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport ${VNC_PORT:-$SE_VNC_PORT} -rfbportv6 ${VNC_PORT:-$SE_VNC_PORT} -display :99.0
else
echo "Vnc won't start because Xvfb is configured to not start."
fi