-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
31 lines (23 loc) · 1.02 KB
/
docker-entrypoint.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
#!/bin/bash
if [ -z "$VNC_PASSWORD" ]; then
echo >&2 'error: No password for VNC connection set.'
echo >&2 ' Did you forget to add -e VNC_PASSWORD=... ?'
exit 1
fi
if [ -z "$XFB_SCREEN" ]; then
XFB_SCREEN=1024x768x24
fi
if [ ! -z "$XFB_SCREEN_DPI" ]; then
DPI_OPTIONS="-dpi $XFB_SCREEN_DPI"
fi
# first we need our security cookie and add it to user's .Xauthority
mcookie | sed -e 's/^/add :0 MIT-MAGIC-COOKIE-1 /' | xauth -q
# now place the security cookie with FamilyWild on volume so client can use it
# see http://stackoverflow.com/25280523 for details on the following command
xauth nlist :0 | sed -e 's/^..../ffff/' | xauth -f /Xauthority/xserver.xauth nmerge -
# now boot X-Server, tell it to our cookie and give it sometime to start up
Xvfb :0 -auth ~/.Xauthority $DPI_OPTIONS -screen 0 $XFB_SCREEN >>~/xvfb.log 2>&1 &
sleep 5
(echo "--- Running Setup ---" && /custom-setup.sh && echo "--- Ran Setup ---") &
# finally we can run the VNC-Server based on our just started X-Server
x11vnc -forever -passwd $VNC_PASSWORD -display :0