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>
This commit is contained in:
2026-01-20 11:46:53 -05:00
parent e19a1739b3
commit 7d286f8f2c
2 changed files with 0 additions and 0 deletions

227
scripts/build-iso.sh Executable file
View File

@@ -0,0 +1,227 @@
#!/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 ""

180
scripts/test-iso.sh Executable file
View File

@@ -0,0 +1,180 @@
#!/bin/bash
# Football ISO Test Script
# Boots QEMU VM from ISO to test installation
# All work done in Docker container
set -e
BUILD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ISO_PATH="$BUILD_DIR/output/football-installer.iso"
DISK_PATH="$BUILD_DIR/output/test-vm-disk.qcow2"
CONSOLE_LOG="$BUILD_DIR/output/vm-console.log"
VM_PID_FILE="$BUILD_DIR/output/vm.pid"
echo "================================================"
echo "Football ISO Test - VM Boot"
echo "================================================"
echo ""
# ============================================================================
# Step 1: Verify ISO Exists
# ============================================================================
echo "[1/4] Verifying ISO..."
if [ ! -f "$ISO_PATH" ]; then
echo "❌ ISO not found: $ISO_PATH"
echo "Run ./build-iso.sh first"
exit 1
fi
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 ""
# ============================================================================
# Step 2: Create Test Disk
# ============================================================================
echo "[2/4] Creating test disk..."
mkdir -p "$BUILD_DIR/output"
docker run --rm \
-v "$BUILD_DIR:/build" \
debian:trixie \
bash -c '
set -e
echo "Installing qemu-utils..."
apt-get update -qq
apt-get install -y -qq qemu-utils
echo ""
echo "Creating 16GB QCOW2 disk..."
cd /build/output
qemu-img create -f qcow2 test-vm-disk.qcow2 16G
echo ""
echo "✅ Test disk created"
ls -lh /build/output/test-vm-disk.qcow2
'
echo ""
echo "✅ Step 2 complete"
echo ""
# ============================================================================
# Step 3: Boot VM from ISO
# ============================================================================
echo "[3/4] Booting VM from ISO..."
echo ""
echo "VM Configuration:"
echo " CPU: 2 cores"
echo " RAM: 2GB"
echo " Disk: 16GB"
echo " Boot: $ISO_PATH"
echo ""
echo "NOTE: VM will boot in background mode"
echo "Console output will be saved to: $CONSOLE_LOG"
echo "To monitor console: tail -f $CONSOLE_LOG"
echo ""
# Start VM with QEMU using screen session
# Using screen to manage long-running QEMU process
screen -dmS football-iso-test \
qemu-system-x86_64 \
-m 2048 \
-smp 2 \
-drive file="$DISK_PATH",format=qcow2 \
-drive file="$ISO_PATH",media=cdrom,readonly=on \
-boot d \
-nographic \
-serial file:"$CONSOLE_LOG" \
-display none
# Save QEMU PID for later use
pgrep -f "qemu-system-x86_64.*$DISK_PATH" | head -1 > "$VM_PID_FILE"
echo "✅ VM started (PID: $(cat $VM_PID_FILE 2>/dev/null || echo 'unknown'))"
echo ""
# ============================================================================
# Step 4: Monitor Boot
# ============================================================================
echo "[4/4] Monitoring boot (waiting 120 seconds)..."
echo ""
for i in {1..120}; do
if [ -f "$CONSOLE_LOG" ]; then
# Check for installation prompts
if grep -q "Choose the country" "$CONSOLE_LOG" 2>/dev/null; then
echo "🟢 Installer running - Country selection detected"
break
fi
# Check for errors
if grep -qi "error\|panic\|fatal" "$CONSOLE_LOG" 2>/dev/null; then
echo "⚠️ Error detected in console"
tail -20 "$CONSOLE_LOG"
break
fi
fi
sleep 1
done
echo ""
echo "==========================================="
echo "VM Status"
echo "==========================================="
echo ""
if [ -f "$VM_PID_FILE" ]; then
VM_PID=$(cat "$VM_PID_FILE" 2>/dev/null || echo 'unknown')
if kill -0 "$VM_PID" 2>/dev/null; then
echo "🟢 VM is running (PID: $VM_PID)"
else
echo "🔴 VM has stopped"
fi
fi
echo ""
echo "Recent console output (last 30 lines):"
if [ -f "$CONSOLE_LOG" ]; then
tail -30 "$CONSOLE_LOG"
else
echo "No console output yet"
fi
echo ""
echo "==========================================="
echo "Manual Access"
echo "==========================================="
echo ""
echo "To access VM console interactively:"
echo " 1. Stop current VM: kill \$(cat $VM_PID_FILE)"
echo " 2. Remove -nographic flag:"
echo " qemu-system-x86_64 \\"
echo " -m 4096 -smp 2 \\"
echo " -drive file=$DISK_PATH,format=qcow2 \\"
echo " -drive file=$ISO_PATH,media=cdrom,readonly=on \\"
echo " -boot d"
echo ""
echo "To stop VM:"
echo " kill \$(cat $VM_PID_FILE)"
echo ""
echo "Console log location: $CONSOLE_LOG"
echo ""