Spaces:
Paused
Paused
Create entrypoint.sh
Browse files- entrypoint.sh +39 -0
entrypoint.sh
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
# ── Clean up stale VNC locks ──────────────────────────────────
|
| 5 |
+
rm -f /tmp/.X1-lock
|
| 6 |
+
rm -f /tmp/.X11-unix/X1
|
| 7 |
+
|
| 8 |
+
# ── Create required dirs ──────────────────────────────────────
|
| 9 |
+
mkdir -p /tmp/.X11-unix
|
| 10 |
+
chmod 1777 /tmp/.X11-unix
|
| 11 |
+
|
| 12 |
+
mkdir -p /home/user/.vnc
|
| 13 |
+
chown -R user:user /home/user/.vnc
|
| 14 |
+
|
| 15 |
+
# ── Write VNC password ────────────────────────────────────────
|
| 16 |
+
echo "hfdesktop" | su user -c "vncpasswd -f > /home/user/.vnc/passwd"
|
| 17 |
+
chmod 600 /home/user/.vnc/passwd
|
| 18 |
+
chown user:user /home/user/.vnc/passwd
|
| 19 |
+
|
| 20 |
+
# ── Start Xvnc directly as user ───────────────────────────────
|
| 21 |
+
su user -c "
|
| 22 |
+
Xvnc :1 \
|
| 23 |
+
-geometry 1280x800 \
|
| 24 |
+
-depth 24 \
|
| 25 |
+
-rfbport 5901 \
|
| 26 |
+
-rfbauth /home/user/.vnc/passwd \
|
| 27 |
+
-SecurityTypes VncAuth \
|
| 28 |
+
-localhost no \
|
| 29 |
+
&
|
| 30 |
+
"
|
| 31 |
+
|
| 32 |
+
# ── Wait for Xvnc to be ready ────────────────────────────────
|
| 33 |
+
sleep 2
|
| 34 |
+
|
| 35 |
+
# ── Start XFCE4 as user ───────────────────────────────────────
|
| 36 |
+
su user -c "DISPLAY=:1 startxfce4 &"
|
| 37 |
+
|
| 38 |
+
# ── Start noVNC ───────────────────────────────────────────────
|
| 39 |
+
exec websockify --web=/usr/share/novnc 7860 localhost:5901
|