25 lines
887 B
Bash
25 lines
887 B
Bash
#!/bin/bash
|
|
# Entrypoint: VNC password setup + DNS fix + systemd
|
|
|
|
set -euo pipefail
|
|
|
|
# Setup TigerVNC password file from env var (passed by runtipi)
|
|
# TigerVNC expects /root/.vnc/passwd when using SecurityTypes=VncAuth.
|
|
if [ -n "${VNC_PASSWORD:-}" ]; then
|
|
mkdir -p /root/.vnc
|
|
printf '%s\n%s\n' "$VNC_PASSWORD" "$VNC_PASSWORD" | vncpasswd -f > /root/.vnc/passwd
|
|
chmod 600 /root/.vnc/passwd
|
|
fi
|
|
|
|
cp /etc/resolv.conf /tmp/resolv.conf.bak 2>/dev/null || true
|
|
cp /etc/hosts /tmp/hosts.bak 2>/dev/null || true
|
|
umount /etc/resolv.conf 2>/dev/null || true
|
|
umount /etc/hosts 2>/dev/null || true
|
|
cat /tmp/resolv.conf.bak > /etc/resolv.conf 2>/dev/null || echo "nameserver 8.8.8.8" > /etc/resolv.conf
|
|
cat /tmp/hosts.bak > /etc/hosts 2>/dev/null || echo "127.0.0.1 localhost" > /etc/hosts
|
|
|
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
|
echo "[entrypoint] IP forwarding enabled"
|
|
|
|
exec /sbin/init
|