#!/usr/bin/env bash # Build a bootable Debian Live USB image with FieldWitness pre-installed. # # Prerequisites: # apt install live-build # # Usage: # cd deploy/live-usb # sudo ./build.sh # # Output: live-image-amd64.hybrid.iso (flash to USB with dd or Balena Etcher) set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" FIELDWITNESS_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" echo "=== FieldWitness Live USB Image Builder ===" echo "Source: $FIELDWITNESS_ROOT" echo cd "$SCRIPT_DIR" # Clean previous builds lb clean 2>/dev/null || true # Configure live-build lb config \ --distribution bookworm \ --architectures amd64 \ --binary-images iso-hybrid \ --memtest none \ --bootappend-live "boot=live components locales=en_US.UTF-8 keyboard-layouts=us" \ --apt-indices false \ --security true \ --updates true # Build echo "Building image (this takes 10-20 minutes)..." lb build echo echo "=== Build complete ===" echo "Image: $(ls -lh live-image-*.iso 2>/dev/null || echo 'Check for .iso file')" echo echo "Flash to USB:" echo " sudo dd if=live-image-amd64.hybrid.iso of=/dev/sdX bs=4M status=progress" echo " (replace /dev/sdX with your USB device)"