Files
football/scripts/build-iso.sh
Charles N Wyble 7d286f8f2c refactor: Move active scripts to scripts/ directory
Moves current active scripts to scripts/ directory:
- build-iso.sh: Creates Debian ISO with preseed
- test-iso.sh: Tests ISO in QEMU VM

Keeps root directory clean and organized.

💘 Generated with Crush

Assisted-by: Gemini 2.5 Flash via Crush <crush@charm.land>
2026-01-20 11:46:53 -05:00

228 lines
6.4 KiB
Bash
Executable File

#!/bin/bash
# Football ISO Build Script
# Creates Debian 13 ISO with embedded preseed configuration
# All work done in Docker container
set -e
BUILD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OUTPUT_DIR="$BUILD_DIR/output"
ISO_DIR="$BUILD_DIR/iso-tmp"
echo "================================================"
echo "Football ISO Build"
echo "================================================"
echo ""
# ============================================================================
# Step 1: Download Debian ISO
# ============================================================================
echo "[1/5] Downloading Debian 13 Netboot ISO..."
mkdir -p "$ISO_DIR"
docker run --rm \
--name football-iso-build \
-v "$BUILD_DIR:/build" \
debian:trixie \
bash -c '
set -e
echo "Installing wget..."
apt-get update -qq
apt-get install -y -qq wget xorriso
echo ""
echo "Downloading Debian Netboot ISO..."
cd /build/iso-tmp
# Download current testing/sid ISO (trixie is still testing)
wget -q --show-progress \
-O debian-amd64-netinst.iso \
https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-sid-amd64-netinst.iso || \
wget -q --show-progress \
-O debian-amd64-netinst.iso \
https://cdimage.debian.org/debian-cd/testing/amd64/iso-cd/debian-testing-amd64-netinst.iso
echo ""
echo "✅ ISO downloaded"
ls -lh /build/iso-tmp/*.iso
'
echo ""
echo "✅ Step 1 complete"
echo ""
# ============================================================================
# Step 2: Extract ISO
# ============================================================================
echo "[2/5] Extracting ISO..."
docker run --rm \
--name football-iso-extract \
-v "$BUILD_DIR:/build" \
debian:trixie \
bash -c '
set -e
echo "Installing extraction tools..."
apt-get update -qq
apt-get install -y -qq xorriso rsync
echo ""
echo "Extracting ISO..."
cd /build/iso-tmp
mkdir -p extracted
xorriso -osirrox on -indev debian-trixie-amd64-netinst.iso \
-extract / extracted/
echo ""
echo "✅ ISO extracted"
echo "Files in extracted:"
ls -la /build/iso-tmp/extracted/
'
echo ""
echo "✅ Step 2 complete"
echo ""
# ============================================================================
# Step 3: Inject Preseed Configuration
# ============================================================================
echo "[3/5] Injecting preseed configuration..."
docker run --rm \
--name football-iso-preseed \
-v "$BUILD_DIR:/build" \
debian:trixie \
bash -c '
set -e
echo "Copying preseed file..."
cp /build/config/preseed.cfg /build/iso-tmp/extracted/preseed.cfg
echo ""
echo "Modifying boot menu to use preseed..."
# Update isolinux.cfg to auto-load preseed
cat > /build/iso-tmp/extracted/isolinux/isolinux.cfg << "EOF"
default football
timeout 5
label football
menu label ^Install Football Secure Access System
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz auto=true priority=critical file=/cdrom/preseed.cfg -- quiet
label manual
menu label ^Manual Install
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz -- quiet
label expert
menu label ^Expert Mode
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz priority=low -- quiet
label rescue
menu label ^Rescue Mode
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz rescue/enable=true -- quiet
EOF
echo ""
echo "✅ Preseed injected"
cat /build/iso-tmp/extracted/isolinux/isolinux.cfg
'
echo ""
echo "✅ Step 3 complete"
echo ""
# ============================================================================
# Step 4: Create ISO
# ============================================================================
echo "[4/5] Creating new ISO with preseed..."
mkdir -p "$OUTPUT_DIR"
docker run --rm \
--name football-iso-create \
-v "$BUILD_DIR:/build" \
debian:trixie \
bash -c '
set -e
echo "Creating ISO..."
cd /build/iso-tmp/extracted
xorriso -as mkisofs \
-r -V "Football Secure System" \
-o /build/output/football-installer.iso \
-J -l -b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-eltorito-alt-boot \
-e boot/grub/efi.img \
-no-emul-boot \
-isohybrid-gpt-basdat \
.
echo ""
echo "✅ ISO created"
ls -lh /build/output/football-installer.iso
'
echo ""
echo "✅ Step 4 complete"
echo ""
# ============================================================================
# Step 5: Verify ISO
# ============================================================================
echo "[5/5] Verifying ISO..."
docker run --rm \
-v "$BUILD_DIR:/build" \
debian:trixie \
bash -c '
echo "ISO information:"
file /build/output/football-installer.iso
echo ""
echo "ISO size:"
ls -lh /build/output/football-installer.iso
echo ""
echo "✅ ISO verified"
'
echo ""
echo "✅ Step 5 complete"
echo ""
# ============================================================================
# Summary
# ============================================================================
echo "================================================"
echo "ISO BUILD COMPLETE"
echo "================================================"
echo ""
echo "Output file:"
echo " 📁 $OUTPUT_DIR/football-installer.iso"
echo ""
echo "Usage:"
echo " 1. Write ISO to USB: sudo dd if=$OUTPUT_DIR/football-installer.iso of=/dev/sdX bs=4M status=progress"
echo " 2. Boot from USB"
echo " 3. Installer will automatically use preseed configuration"
echo " 4. User only needs to provide:"
echo " - Username"
echo " - User password (min 12 chars, mixed case, numbers, special chars)"
echo " - Root password (min 12 chars, mixed case, numbers, special chars)"
echo " - Target disk for installation"
echo ""
echo "✅ BUILD COMPLETE!"
echo ""