Files
archy/image-recipe/create-fat32-usb.sh
Dorian a0a7aadcb3
All checks were successful
Build Archipelago ISO (dev) / build-iso (push) Successful in 12m25s
chore: Debian 12 → 13 (Trixie) migration, service hardening
- Update all references from Debian 12 (Bookworm) to Debian 13 (Trixie)
- Enable SystemCallArchitectures, RestrictAddressFamilies, RestrictRealtime
  in archipelago.service (safe on systemd 256+ which respects NoNewPrivileges=no)
- Update GLIBC compatibility checks from 2.36 to 2.40
- ISO filename, build container, and docs updated throughout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 21:32:08 +02:00

91 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
#
# Create bootable FAT32 USB from Archipelago ISO
# This extracts the ISO contents to FAT32 for UEFI boot
#
# Usage: ./create-fat32-usb.sh /dev/diskN
#
set -e
# Get absolute path of script directory
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ -z "$1" ]; then
echo "Usage: $0 /dev/diskN"
echo ""
echo "Available disks:"
diskutil list external
exit 1
fi
USB_DISK="$1"
ISO_FILE="$SCRIPT_DIR/results/archipelago-debian-13-x86_64.iso"
WORK_DIR="$SCRIPT_DIR/build/usb-extract"
if [ ! -f "$ISO_FILE" ]; then
echo "❌ ISO not found: $ISO_FILE"
echo ""
echo "Build the ISO first with: ./build-debian-iso.sh"
exit 1
fi
echo "╔════════════════════════════════════════════════════════╗"
echo "║ Create FAT32 Bootable USB ║"
echo "╚════════════════════════════════════════════════════════╝"
echo ""
echo "⚠️ WARNING: This will COMPLETELY ERASE $USB_DISK"
echo ""
echo "📀 ISO: $(basename "$ISO_FILE")"
echo "💾 USB: $USB_DISK"
echo ""
echo "Press Ctrl+C to cancel, or Enter to continue..."
read
# Clean up work directory
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR"
echo "🔓 Unmounting USB..."
diskutil unmountDisk "$USB_DISK" || true
echo ""
echo "🗂️ Formatting USB as FAT32 with MBR..."
diskutil eraseDisk FAT32 ARCHIPELAGO MBR "$USB_DISK"
echo ""
echo "📦 Extracting ISO contents..."
cd "$WORK_DIR"
7z x -y "$ISO_FILE"
echo ""
echo "📋 Copying files to USB (this may take a few minutes)..."
USB_MOUNT="/Volumes/ARCHIPELAGO"
if [ ! -d "$USB_MOUNT" ]; then
echo "❌ USB not mounted at $USB_MOUNT"
exit 1
fi
# Copy all extracted files
cp -Rv "$WORK_DIR"/* "$USB_MOUNT/" 2>/dev/null | tail -5
echo " (showing last 5 files copied)"
echo ""
echo "🔄 Syncing..."
sync
echo ""
echo "✅ USB created successfully!"
echo ""
echo "Now:"
echo " 1. Eject: diskutil eject $USB_DISK"
echo " 2. Insert into target machine"
echo " 3. Boot from USB (F12 or similar for boot menu)"
echo ""
echo "Default login (live mode):"
echo " Username: user"
echo " Password: live"
# Cleanup
rm -rf "$WORK_DIR"