Files
cloudhost/seediso/windows11/build-seed.sh
T
guofangandClaude Sonnet 5.5 c13ebc7d11 Support arm64 hosts in the Windows 11 launcher
Pick qemu-system-aarch64, the AArch64 UEFI firmware and a per-architecture
QEMU config (NVMe disk, virtio-net, ramfb, USB installation media) on arm64,
render the answer file for the target architecture, and move the q35-only
disk and NIC devices out of the shared config. Update vm-images to match
arm64 Windows ISO names.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 14:23:44 +08:00

41 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
output="${1:-${script_dir}/seed.iso}"
arch="${2:-${VM_IMAGE_ARCH:-$(uname -m)}}"
case "$arch" in
arm64|aarch64) answer_arch=arm64 ;;
x86_64|amd64) answer_arch=amd64 ;;
*) printf 'Error: unsupported architecture: %s\n' "$arch" >&2; exit 1 ;;
esac
# The answer file's components name the processor architecture, so render a
# copy for the target architecture.
work_dir="$(mktemp -d)"
trap 'rm -rf "$work_dir"' EXIT
sed "s/processorArchitecture=\"amd64\"/processorArchitecture=\"${answer_arch}\"/" \
"$script_dir/Autounattend.xml" >"$work_dir/Autounattend.xml"
seed_files=(
"$work_dir/Autounattend.xml"
"$script_dir/Configure-Windows.ps1"
)
# Numbered installer scripts (10-Install-Git.bat, 20-..., in install order).
shopt -s nullglob
seed_files+=("$script_dir"/[0-9][0-9]-*.bat)
shopt -u nullglob
mkdir -p "$(dirname -- "$output")"
if command -v xorriso >/dev/null 2>&1; then
xorriso -as mkisofs -quiet -o "$output" -V CIDATA -J -r "${seed_files[@]}"
elif command -v genisoimage >/dev/null 2>&1; then
genisoimage -quiet -o "$output" -V CIDATA -J -r "${seed_files[@]}"
elif command -v mkisofs >/dev/null 2>&1; then
mkisofs -quiet -o "$output" -V CIDATA -J -r "${seed_files[@]}"
else
printf 'Error: install xorriso, genisoimage, or mkisofs.\n' >&2
exit 1
fi
printf 'Built Windows 11 answer-file ISO: %s\n' "$output"