fix(deploy): purge Pi welcome wizard + mask display managers

systemctl disable lets apt upgrades re-enable a DM. Mask everything
that could put a desktop on tty1. Purge piwiz + userconf-pi (the
"Welcome to Raspberry Pi" first-run wizard) and wipe /etc/motd +
/etc/update-motd.d so even on console nothing identifies as Pi.
This commit is contained in:
Mitchell R 2026-05-13 03:31:47 +02:00
parent 50fd9046bc
commit 93cf261f07

View file

@ -172,13 +172,28 @@ if [ "${INSTALL_KIOSK}" = "1" ]; then
fi fi
done done
echo "==> Disabling display managers + getty@tty1" echo "==> Disabling + masking display managers, removing Pi first-run wizard"
for dm in lightdm gdm gdm3 sddm; do # Mask (not just disable) so nothing — apt upgrades, dependencies — can
# re-enable a display manager later.
for dm in lightdm gdm gdm3 sddm display-manager; do
systemctl disable --now "${dm}.service" 2>/dev/null || true systemctl disable --now "${dm}.service" 2>/dev/null || true
systemctl mask "${dm}.service" 2>/dev/null || true
done done
systemctl set-default multi-user.target systemctl set-default multi-user.target
systemctl disable --now getty@tty1.service 2>/dev/null || true systemctl disable --now getty@tty1.service 2>/dev/null || true
# piwiz = "Welcome to Raspberry Pi" first-run wizard. userconf-pi runs at
# first boot if no user is configured. Purge both so they can't fire.
DEBIAN_FRONTEND=noninteractive apt-get purge -y piwiz userconf-pi 2>/dev/null || true
rm -f /etc/xdg/autostart/piwiz.desktop
systemctl disable --now userconf.service userconf-pi.service 2>/dev/null || true
systemctl mask userconf.service userconf-pi.service 2>/dev/null || true
# Suppress the Debian/Pi console motd and /etc/issue text on tty.
: > /etc/motd
printf 'BetterFrame Kiosk\n\n' > /etc/issue
rm -f /etc/update-motd.d/10-uname /etc/update-motd.d/* 2>/dev/null || true
echo "==> Installing PAM + systemd unit" echo "==> Installing PAM + systemd unit"
install -m 644 "${REPO_ROOT}/deploy/pam.d/cage" /etc/pam.d/cage install -m 644 "${REPO_ROOT}/deploy/pam.d/cage" /etc/pam.d/cage
install -m 644 "${REPO_ROOT}/deploy/systemd/betterframe-kiosk.service" \ install -m 644 "${REPO_ROOT}/deploy/systemd/betterframe-kiosk.service" \