mathematica / entrypoint.sh
georgesnoe's picture
Update entrypoint.sh
b92a4ae verified
#!/bin/bash
set -e
# ── Clean up stale VNC locks ──────────────────────────────────
rm -f /tmp/.X1-lock
rm -f /tmp/.X11-unix/X1
# ── Create required dirs ──────────────────────────────────────
mkdir -p /tmp/.X11-unix
chmod 1777 /tmp/.X11-unix
mkdir -p /home/georgesnoe/.vnc
chown -R georgesnoe:georgesnoe /home/georgesnoe/.vnc
# ── Write VNC password ────────────────────────────────────────
echo "h7pp017t€" | su georgesnoe -c "vncpasswd -f > /home/georgesnoe/.vnc/passwd"
chmod 600 /home/georgesnoe/.vnc/passwd
chown georgesnoe:georgesnoe /home/georgesnoe/.vnc/passwd
# ── Start Xvnc directly as georgesnoe ────────────────────────
su georgesnoe -c "
Xvnc :1 \
-geometry 1280x800 \
-depth 24 \
-rfbport 5901 \
-rfbauth /home/georgesnoe/.vnc/passwd \
-SecurityTypes VncAuth \
-localhost no \
&
"
# ── Wait for Xvnc to be ready ────────────────────────────────
sleep 2
# ── Start XFCE4 as georgesnoe ────────────────────────────────
su georgesnoe -c "DISPLAY=:1 startxfce4 &"
# ── Start noVNC in background ─────────────────────────────────
websockify --web=/usr/share/novnc 7860 localhost:5901 &
# ── Start Cloudflare Quick Tunnel ────────────────────────────
echo ""
echo "========================================="
echo " Cloudflare Tunnel starting..."
echo " Ton URL apparaîtra ci-dessous"
echo "========================================="
exec cloudflared tunnel --url http://localhost:7860 --no-autoupdate