feat: add custom Debian ISO build for automated silent installation

This commit is contained in:
2026-05-23 12:37:31 +00:00
parent 38f7ae467a
commit b7866000b4
4 changed files with 437 additions and 0 deletions
+161
View File
@@ -0,0 +1,161 @@
#!/bin/bash
set -e
# Post-install script for SeniorNet Kiosk ISO
# Runs after Debian installation completes
echo "==> SeniorNet Kiosk Post-Install"
echo
REPO_DIR="/home/jgitta/kiosk-browser"
HOME_DIR="/home/jgitta/kiosk-home"
CHROMIUM_PROFILE="/home/jgitta/chromium-kiosk"
# Ensure jgitta user exists
if ! id "jgitta" &>/dev/null; then
useradd -m -s /bin/bash jgitta
fi
# Install packages
echo "==> Installing dependencies..."
apt-get update
apt-get install -y python3 python3-pip chromium openbox xserver-xorg xserver-xorg-video-dummy xinit xdotool xprop git sqlite3 xvfb 2>&1 | grep -v "^Reading"
# Install Python packages
echo "==> Installing Python packages..."
pip3 install --break-system-packages PyQt5 websocket-client 2>&1 | tail -5
# Clone repo
echo "==> Cloning repository..."
if [ ! -d "$REPO_DIR" ]; then
git clone https://gitea.jgitta.com/jgitta/senior-kiosk.git "$REPO_DIR"
fi
cd "$REPO_DIR"
# Deploy home screen with config
echo "==> Deploying home screen..."
mkdir -p "$HOME_DIR"
if [ -f config.json ] && [ -f home-screen-index.html ]; then
config_json=$(cat config.json | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | tr '\n' ' ')
sed "s|const config = {};|const config = $config_json;|" home-screen-index.html > "$HOME_DIR/index.html"
chown jgitta:jgitta "$HOME_DIR/index.html"
fi
# Create Chromium profile directory
mkdir -p "$CHROMIUM_PROFILE"
chown -R jgitta:jgitta "$CHROMIUM_PROFILE"
# Systemd units
echo "==> Installing systemd units..."
cat > /etc/systemd/system/kiosk-display.service << 'UNIT1'
[Unit]
Description=SeniorNet Kiosk Display
Before=kiosk.service
After=network.target
[Service]
Type=forking
User=jgitta
ExecStart=/bin/bash -c 'Xvfb :0 -screen 0 1920x1080x24 -ac &'
ExecStartPost=/bin/sleep 2
ExecStartPost=/bin/bash -c 'DISPLAY=:0 su - jgitta -c "openbox &"'
ExecStartPost=/bin/sleep 1
[Install]
WantedBy=multi-user.target
UNIT1
cat > /etc/systemd/system/kiosk.service << 'UNIT2'
[Unit]
Description=SeniorNet Kiosk
After=network.target kiosk-display.service
Wants=kiosk-display.service
[Service]
Type=simple
User=jgitta
Environment="DISPLAY=:0"
WorkingDirectory=/home/jgitta/kiosk-browser
ExecStart=/usr/bin/python3 /home/jgitta/kiosk-browser/browser.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
UNIT2
systemctl daemon-reload
systemctl enable kiosk-display.service kiosk.service
# kiosk-restart helper
cat > /usr/local/bin/kiosk-restart << 'HELPER'
#!/bin/bash
pkill -f "remote-debugging-port=9222" || true
pkill -f "python3.*browser" || true
sleep 1
systemctl restart kiosk.service
HELPER
chmod +x /usr/local/bin/kiosk-restart
# Openbox config
echo "==> Configuring Openbox..."
mkdir -p /home/jgitta/.config/openbox
cat > /home/jgitta/.config/openbox/rc.xml << 'OPENBOX'
<?xml version="1.0" encoding="UTF-8"?>
<openbox_config xmlns="http://openbox.org/3.4/rc">
<startup/>
</openbox_config>
OPENBOX
cat > /home/jgitta/.xinitrc << 'XINITRC'
#!/bin/bash
exec openbox
XINITRC
chmod +x /home/jgitta/.xinitrc
# X11 hardening
echo "==> Configuring X11..."
cat > /etc/X11/xorg.conf.d/50-kiosk.conf << 'XORG'
Section "Device"
Identifier "Dummy0"
Driver "dummy"
EndSection
Section "Monitor"
Identifier "Monitor0"
HorizSync 30-80
VertRefresh 30-75
EndSection
Section "Screen"
Identifier "Screen0"
Device "Dummy0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
Section "ServerFlags"
Option "DontVTSwitch" "true"
Option "BlankTime" "0"
Option "StandbyTime" "0"
EndSection
XORG
# Permissions
echo "==> Setting permissions..."
chown -R jgitta:jgitta /home/jgitta/.config /home/jgitta/.xinitrc "$REPO_DIR" "$HOME_DIR"
# Enable getty on ttys for troubleshooting (optional, comment out for full lockdown)
systemctl set-default multi-user.target
echo
echo "==> Post-install complete"
echo " Machine will auto-start kiosk on next boot"
echo