generated from oci/template
Add vnc.sh
Some checks failed
Build Docker Image on Commit / build-and-publish (push) Failing after 5s
Some checks failed
Build Docker Image on Commit / build-and-publish (push) Failing after 5s
This commit is contained in:
parent
3d3f233e0d
commit
0d8874c367
1 changed files with 38 additions and 0 deletions
38
vnc.sh
Normal file
38
vnc.sh
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Prepare variables
|
||||
: "${VNC_BUILTIN_WIDTH:=1280}"
|
||||
: "${VNC_BUILTIN_HEIGHT:=720}"
|
||||
: "${VNC_BUILTIN_PIXELDEPTH:=24}"
|
||||
: "${VNC_BUILTIN_DISABLED:=false}"
|
||||
|
||||
if [ "${VNC_BUILTIN_DISABLED}" = true ]; then
|
||||
echo "Builtin VNC is disabled. You must ensure the DISPLAY variable is set and the target display is accessible"
|
||||
echo "Using display ${DISPLAY}"
|
||||
else
|
||||
echo "Builtin VNC is enabled. The DISPLAY variable will be ignored and overwritten"
|
||||
export DISPLAY=":0"
|
||||
|
||||
echo "Using display ${DISPLAY} with size of ${VNC_BUILTIN_WIDTH}x${VNC_BUILTIN_HEIGHT} and pixel depth ${VNC_BUILTIN_PIXELDEPTH}"
|
||||
Xvfb ${DISPLAY} -screen 0 "${VNC_BUILTIN_WIDTH}x${VNC_BUILTIN_HEIGHT}x${VNC_BUILTIN_PIXELDEPTH}" &
|
||||
fi
|
||||
|
||||
# Wait for the display to become ready
|
||||
while true
|
||||
do
|
||||
if xdpyinfo -display "${DISPLAY}" > /dev/null 2>&1; then
|
||||
echo "Display ${DISPLAY} is ready!"
|
||||
break
|
||||
else
|
||||
echo "Waiting for display ${DISPLAY} to become ready..."
|
||||
sleep 0.25
|
||||
fi
|
||||
done
|
||||
|
||||
# Launch the VNC server if enabled
|
||||
if [ "${VNC_BUILTIN_DISABLED}" != true ]; then
|
||||
x11vnc -bg -forever -nopw -display ${DISPLAY} &
|
||||
fi
|
||||
|
||||
# Launch OpenBox
|
||||
openbox &
|
Loading…
Reference in a new issue