From c247536d403c09f74bc254e52f0a9edb2f819949 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 23 Feb 2026 19:41:53 -0600 Subject: feat: add preflight checks, rename ISO format, use Makefile targets in docs - Add Arch Linux and disk space preflight checks to build.sh - Rename ISO format: archangel-YYYY-MM-DD-vmlinuz-version-lts-x86_64.iso - Update README to use Makefile targets throughout (make build, make clean) - Note preflight checks in Prerequisites section --- README.org | 29 ++++++++++++++++------------- build.sh | 16 +++++++++++----- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/README.org b/README.org index 5c7fd53..ccf273c 100644 --- a/README.org +++ b/README.org @@ -40,20 +40,23 @@ Archangel currently uses linux-lts for stability. Choosing linux and linux-zen k * Quick Start #+BEGIN_SRC bash -# Build the ISO (requires root) -sudo ./build.sh +# Build the ISO (requires sudo) +make build # Test in a VM -./scripts/test-vm.sh +make test-install -# Or test with multiple disks for RAID -./scripts/test-vm.sh --multi-disk +# Or launch a VM manually for interactive testing +./scripts/test-vm.sh +./scripts/test-vm.sh --multi-disk # multiple disks for RAID #+END_SRC Boot the ISO and run ~archangel~ to start the installation. * Prerequisites +The build script will report if you're missing any of these in a preflight check. + ** Build Host Requirements - Arch Linux (or Arch-based distribution) - Root/sudo access @@ -71,7 +74,7 @@ Boot the ISO and run ~archangel~ to start the installation. ** Basic Build #+BEGIN_SRC bash -sudo ./build.sh +make build #+END_SRC The build script will: @@ -84,15 +87,15 @@ The build script will: ** Build Output -- ISO location: ~out/archangel-vmlinuz-{version}-lts-YYYY-MM-DD-x86_64.iso~ -- Example: ~archangel-vmlinuz-6.12.65-lts-2026-01-18-x86_64.iso~ +- ISO location: ~out/archangel-YYYY-MM-DD-vmlinuz-{version}-lts-x86_64.iso~ +- Example: ~archangel-2026-01-18-vmlinuz-6.12.65-lts-x86_64.iso~ - Build logs: visible in terminal output (not saved to disk) ** Clean Rebuild #+BEGIN_SRC bash -sudo rm -rf work out -sudo ./build.sh +make clean +make build #+END_SRC * Project Structure @@ -284,7 +287,7 @@ A complete example with all options is available at ~installer/archangel.conf.ex #+BEGIN_SRC bash # Write ISO to USB drive (replace /dev/sdX) -sudo dd if=out/archangel-vmlinuz-*.iso of=/dev/sdX bs=4M status=progress oflag=sync +sudo dd if=out/archangel-*.iso of=/dev/sdX bs=4M status=progress oflag=sync #+END_SRC ** Booting @@ -397,8 +400,8 @@ operations only. Do not expose the live environment to untrusted networks. Clean the work directory and rebuild: #+BEGIN_SRC bash -sudo rm -rf work -sudo ./build.sh +make clean +make build #+END_SRC ** ZFS Module Not Loading diff --git a/build.sh b/build.sh index b94b731..a2e3ca3 100755 --- a/build.sh +++ b/build.sh @@ -74,10 +74,15 @@ cleanup_on_exit() { } trap cleanup_on_exit EXIT INT TERM -# Check root +# Preflight checks [[ $EUID -ne 0 ]] && error "This script must be run as root" +[[ -f /etc/arch-release ]] || error "This script must be run on Arch Linux" + +MIN_FREE_GB=10 +free_kb=$(df --output=avail "$SCRIPT_DIR" | tail -1) +free_gb=$((free_kb / 1024 / 1024)) +[[ $free_gb -lt $MIN_FREE_GB ]] && error "Insufficient disk space: ${free_gb}GB free, ${MIN_FREE_GB}GB required" -# Check dependencies command -v mkarchiso >/dev/null 2>&1 || { info "Installing archiso..." pacman -Sy --noconfirm archiso @@ -270,10 +275,11 @@ info "LTS Kernel version: $KERNEL_VER" # Update profiledef.sh with our ISO name info "Updating ISO metadata..." -# Format: archangel-vmlinuz-6.12.65-lts-2026-01-18-x86_64.iso +# Format: archangel-2026-01-18-vmlinuz-6.12.65-lts-x86_64.iso +# mkarchiso builds: {iso_name}-{iso_version}-{arch}.iso ISO_DATE=$(date +%Y-%m-%d) -sed -i "s/^iso_name=.*/iso_name=\"archangel-vmlinuz-${KERNEL_VER}-lts\"/" "$PROFILE_DIR/profiledef.sh" -sed -i "s/^iso_version=.*/iso_version=\"${ISO_DATE}\"/" "$PROFILE_DIR/profiledef.sh" +sed -i "s/^iso_name=.*/iso_name=\"archangel-${ISO_DATE}\"/" "$PROFILE_DIR/profiledef.sh" +sed -i "s/^iso_version=.*/iso_version=\"vmlinuz-${KERNEL_VER}-lts\"/" "$PROFILE_DIR/profiledef.sh" # Fixed label for stable GRUB boot entry (default is date-based ARCH_YYYYMM) sed -i "s/^iso_label=.*/iso_label=\"ARCHANGEL\"/" "$PROFILE_DIR/profiledef.sh" -- cgit v1.2.3