This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / tools / build-installer-iso / build-installer-iso.sh
1.6 kB 73 lines
1#!/usr/bin/env bash 2set -euo pipefail 3set -x 4 5# Default values 6OUTPUT="installer.iso" 7ARCH="x86_64-linux" # Default to x86_64-linux for cross-compilation 8VARS_DIR="" 9 10usage() { 11 cat <<EOF 12Usage: $0 [OPTIONS] 13 14Build a NixOS installer ISO with custom vars appended. 15 16OPTIONS: 17 -o, --output FILE Output ISO file (default: installer.iso) 18 -a, --arch ARCH Architecture: x86_64-linux or aarch64-linux (default: x86_64-linux) 19 -v, --vars DIR Directory containing vars to append to ISO 20 -h, --help Show this help message 21 22EXAMPLE: 23 $0 -o my-installer.iso -v ./my-vars -a x86_64-linux 24EOF 25} 26 27# Parse arguments 28while [[ $# -gt 0 ]]; do 29 case $1 in 30 -o|--output) 31 OUTPUT="$2" 32 shift 2 33 ;; 34 -a|--arch) 35 ARCH="$2" 36 shift 2 37 ;; 38 -v|--vars) 39 VARS_DIR="$2" 40 shift 2 41 ;; 42 -h|--help) 43 usage 44 exit 0 45 ;; 46 *) 47 echo "Unknown option: $1" 48 usage 49 exit 1 50 ;; 51 esac 52done 53 54# Build the base ISO 55echo "Building base ISO for $ARCH..." 56BASE_ISO=$(nix build -L --no-link --print-out-paths "$FLAKE_ROOT#clanInternals.machines.$ARCH.installer.config.system.build.images.iso-installer") 57 58if [ -z "$VARS_DIR" ]; then 59 # No vars specified, just copy the base ISO 60 echo "No vars directory specified, copying base ISO..." 61 cp "$BASE_ISO"/iso/*.iso "$OUTPUT" 62else 63 # Append vars using xorriso - preserve boot structure 64 echo "Appending vars from $VARS_DIR to ISO..." 65 xorriso \ 66 -indev "$BASE_ISO"/iso/*.iso \ 67 -outdev "$OUTPUT" \ 68 -boot_image any replay \ 69 -map "$VARS_DIR" /vars \ 70 -commit_eject all 71fi 72 73echo "ISO created: $OUTPUT"