120 lines
2.9 KiB
Bash
Executable File
120 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Build SeniorNet Kiosk ISO
|
|
# Run on workstation: ./build-iso.sh
|
|
# Requires: debian-live-build, sudo
|
|
|
|
echo "==> SeniorNet Kiosk ISO Builder"
|
|
echo
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "ERROR: Run as root (sudo ./build-iso.sh)"
|
|
exit 1
|
|
fi
|
|
|
|
# Check dependencies
|
|
if ! command -v lb &>/dev/null; then
|
|
echo "==> Installing debian-live-build..."
|
|
apt-get update
|
|
apt-get install -y debian-live-build
|
|
fi
|
|
|
|
BUILD_DIR="/tmp/kiosk-build-$$"
|
|
OUTPUT_DIR="$(pwd)/iso-output"
|
|
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
mkdir -p "$BUILD_DIR" "$OUTPUT_DIR"
|
|
cd "$BUILD_DIR"
|
|
|
|
echo "==> Initializing live-build..."
|
|
lb config \
|
|
--distribution trixie \
|
|
--architectures amd64 \
|
|
--image-type iso-hybrid \
|
|
--bootappend-live "boot=live components autologin username=root quiet splash" \
|
|
--bootappend-install "preseed/file=/preseed.cfg auto=true priority=critical" \
|
|
--linux-packages "linux-image-amd64" \
|
|
--parent-mirror-bootstrap "https://deb.debian.org/debian" \
|
|
--parent-mirror-binary "https://deb.debian.org/debian" \
|
|
--parent-mirror-binary-security "https://security.debian.org/debian-security" \
|
|
--parent-distribution-binary-security trixie-security
|
|
|
|
echo "==> Adding packages..."
|
|
mkdir -p config/package-lists
|
|
cat > config/package-lists/kiosk.list.chroot << 'PKGLIST'
|
|
# Base system
|
|
openssh-server
|
|
build-essential
|
|
git
|
|
curl
|
|
wget
|
|
sudo
|
|
|
|
# Display and window manager
|
|
xserver-xorg
|
|
xserver-xorg-video-dummy
|
|
xinit
|
|
openbox
|
|
xvfb
|
|
xdotool
|
|
xprop
|
|
|
|
# Chromium browser
|
|
chromium
|
|
|
|
# Python and kiosk app
|
|
python3
|
|
python3-pip
|
|
sqlite3
|
|
PKGLIST
|
|
|
|
echo "==> Adding preseed file..."
|
|
mkdir -p config/includes.installer
|
|
cp "$REPO_DIR/preseed.cfg" config/includes.installer/
|
|
|
|
echo "==> Adding hook script..."
|
|
mkdir -p config/hooks/normal
|
|
cat > config/hooks/normal/9999-kiosk-postinstall.chroot << 'HOOK'
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
echo "==> Running kiosk post-install hook..."
|
|
|
|
# Install Python packages
|
|
pip3 install --break-system-packages PyQt5 websocket-client
|
|
|
|
# Clone repo
|
|
if [ ! -d /home/jgitta/kiosk-browser ]; then
|
|
git clone https://gitea.jgitta.com/jgitta/senior-kiosk.git /home/jgitta/kiosk-browser
|
|
cd /home/jgitta/kiosk-browser
|
|
bash install-kiosk.sh
|
|
fi
|
|
|
|
echo "==> Kiosk post-install complete"
|
|
HOOK
|
|
chmod +x config/hooks/normal/9999-kiosk-postinstall.chroot
|
|
|
|
echo "==> Building ISO (this may take 5-10 minutes)..."
|
|
lb build 2>&1 | tail -20
|
|
|
|
ISO_FILE="live-image-amd64.hybrid.iso"
|
|
if [ -f "$ISO_FILE" ]; then
|
|
cp "$ISO_FILE" "$OUTPUT_DIR/seniornet-kiosk.iso"
|
|
echo
|
|
echo "==> ✓ ISO build complete!"
|
|
echo " Output: $OUTPUT_DIR/seniornet-kiosk.iso"
|
|
echo
|
|
echo "Next steps:"
|
|
echo " 1. Write to USB:"
|
|
echo " sudo dd if=$OUTPUT_DIR/seniornet-kiosk.iso of=/dev/sdX bs=4M status=progress && sync"
|
|
echo
|
|
echo " 2. Boot from USB and wait ~10 minutes for silent installation"
|
|
echo
|
|
echo " 3. Machine will reboot into kiosk mode automatically"
|
|
echo
|
|
else
|
|
echo "ERROR: ISO build failed"
|
|
exit 1
|
|
fi
|