# startup — only take over the console session on tty1; leave other
# logins (SSH, other VTs) alone
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
    # delete Chromium lock file
    rm -f /tmp/chromium-1/SingletonLock

    # Replace the login shell with the X session: when X exits (crash or
    # kiosk-refresh), the session closes and getty's autologin restarts
    # it, giving a self-healing X loop instead of a stranded console.
    exec startx -- -nocursor >/dev/null 2>&1
fi
