2026-05-25 17:08:15 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
mkdir -p /root/.vnc /root/.ssh
|
|
|
|
|
chmod 700 /root/.ssh
|
|
|
|
|
|
2026-05-25 19:36:36 -08:00
|
|
|
# Clean up stale X lock files from previous container runs
|
|
|
|
|
rm -f /tmp/.X1-lock /tmp/.X11-unix/X1
|
|
|
|
|
|
2026-05-25 17:08:15 -08:00
|
|
|
# Set VNC password from environment
|
|
|
|
|
echo "${VNC_PASSWORD:?VNC_PASSWORD must be set}" | vncpasswd -f > /root/.vnc/passwd
|
|
|
|
|
chmod 600 /root/.vnc/passwd
|
|
|
|
|
|
|
|
|
|
# Start Xvnc (headless X server + VNC server in one)
|
|
|
|
|
Xvnc :1 \
|
|
|
|
|
-rfbport 5901 \
|
|
|
|
|
-SecurityTypes VncAuth \
|
|
|
|
|
-PasswordFile /root/.vnc/passwd \
|
2026-05-25 21:04:59 -08:00
|
|
|
-geometry 1920x1080 \
|
2026-05-25 17:08:15 -08:00
|
|
|
-depth 24 \
|
|
|
|
|
-AlwaysShared \
|
|
|
|
|
&
|
|
|
|
|
|
|
|
|
|
export DISPLAY=:1
|
|
|
|
|
sleep 2
|
|
|
|
|
|
2026-05-25 19:14:53 -08:00
|
|
|
# Start KDE Plasma session
|
|
|
|
|
dbus-run-session -- startplasma-x11 &
|
2026-05-25 17:08:15 -08:00
|
|
|
|
|
|
|
|
# Serve noVNC web UI + bridge WebSocket -> VNC
|
|
|
|
|
exec websockify --web /usr/share/novnc 6080 localhost:5901
|