Files
pc-unlocker/config/hooks/normal/0100-autostart.hook.chroot
2026-10-22 12:32:47 +02:00

48 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Live-System so einrichten, dass es direkt in die PC-Unlocker-GUI bootet.
# Laeuft im chroot waehrend des live-build.
set -e
# 1) Autologin als root auf tty1
mkdir -p /etc/systemd/system/getty@tty1.service.d
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf <<'EOF'
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM
EOF
# 2) Nach dem Login auf tty1 automatisch X starten
cat > /root/.bash_profile <<'EOF'
# Nur auf der ersten Konsole und wenn X noch nicht laeuft
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
exec startx
fi
EOF
# 3) X startet openbox, openbox startet die Anwendung
cat > /root/.xinitrc <<'EOF'
#!/bin/sh
exec openbox-session
EOF
chmod +x /root/.xinitrc
mkdir -p /root/.config/openbox
cat > /root/.config/openbox/autostart <<'EOF'
# Bildschirm nicht abschalten
xset s off -dpms &
# Hintergrund neutral
xsetroot -solid "#20252b" &
# PC-Unlocker; bei Absturz Fallback-Terminal
( pc-unlocker || xterm ) &
EOF
# 4) Launcher
cat > /usr/local/bin/pc-unlocker <<'EOF'
#!/bin/sh
cd /opt/pc-unlocker
exec python3 pc_unlocker.py "$@"
EOF
chmod +x /usr/local/bin/pc-unlocker
echo "pc-unlocker autostart hook done."