Match Windows 11 arm64 ISO names on arm64 hosts

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
guofangandClaude Sonnet 5.5 committed 2026-10-17 13:51:35 +08:00
1 parent 6286495d27
commit 4d9e1b43d9
2 files changed
+21 -9

No files matched your search

+4 -3
View File
@@ -24,8 +24,9 @@ Download or check selected targets:
The Windows installation ISO is not downloaded because Microsoft's temporary The Windows installation ISO is not downloaded because Microsoft's temporary
download URLs expire. Place it manually in `install-iso/`; the script finds it download URLs expire. Place it manually in `install-iso/`; the script finds it
automatically by matching `Win`, `11`, `x64` and `.iso` in that order automatically by matching `Win`, `11`, the architecture (`x64`, or `arm64` on
(`*Win*11*x64*.iso`, case-insensitive). If several files match, the highest arm64 hosts) and `.iso` in that order (`*Win*11*x64*.iso` or
`*Win*11*arm64*.iso`, case-insensitive). If several files match, the highest
version-sorted name is used. Check which file was picked with version-sorted name is used. Check which file was picked with
`./download-images.sh --print-path windows11 --iso`. `./download-images.sh --print-path windows11 --iso`.
@@ -47,7 +48,7 @@ The Windows target prints the QCOW2 path by default. Add `--iso` to print its
manually supplied installation ISO path. The QCOW2 is named after the detected manually supplied installation ISO path. The QCOW2 is named after the detected
ISO (for example `Win11_25H2_English_x64_v2.iso` → ISO (for example `Win11_25H2_English_x64_v2.iso` →
`base-qcow2/Win11_25H2_English_x64_v2.qcow2`); if no ISO is present, an `base-qcow2/Win11_25H2_English_x64_v2.qcow2`); if no ISO is present, an
existing `*Win*11*x64*.qcow2` in `base-qcow2/` is used instead. existing `*Win*11*x64*.qcow2` (`*Win*11*arm64*.qcow2` on arm64) in `base-qcow2/` is used instead.
Download URLs can be overridden with `DEBIAN_IMAGE_URL`, `ALMA_IMAGE_URL`, Download URLs can be overridden with `DEBIAN_IMAGE_URL`, `ALMA_IMAGE_URL`,
`FEDORA_IMAGE_URL`, `UBUNTU_IMAGE_URL`, and `VIRTIO_WIN_ISO_URL`. Each may `FEDORA_IMAGE_URL`, `UBUNTU_IMAGE_URL`, and `VIRTIO_WIN_ISO_URL`. Each may
+17 -6
View File
@@ -57,8 +57,17 @@ fi
virtio_image="${tools_iso_dir}/virtio-win.iso" virtio_image="${tools_iso_dir}/virtio-win.iso"
# Find a Windows 11 x64 file in a directory by matching "Win", "11", "x64" and # Windows 11 media is named after the architecture: x64 on amd64 hosts and
# the extension in that order (case-insensitive). When several match, the # Arm64 on arm64 hosts.
if [[ "$image_arch" == arm64 ]]; then
windows_arch=arm64
else
windows_arch=x64
fi
# Find a Windows 11 file for the current architecture in a directory by
# matching "Win", "11", the architecture and the extension in that order
# (case-insensitive). When several match, the
# highest version-sorted name wins. # highest version-sorted name wins.
find_windows_image() { find_windows_image() {
local dir="$1" local dir="$1"
@@ -67,7 +76,7 @@ find_windows_image() {
match="$( match="$(
shopt -s nullglob nocaseglob shopt -s nullglob nocaseglob
files=("${dir}"/*Win*11*x64*."${extension}") files=("${dir}"/*Win*11*"${windows_arch}"*."${extension}")
((${#files[@]} == 0)) || printf '%s\n' "${files[@]}" | sort -V | tail -n 1 ((${#files[@]} == 0)) || printf '%s\n' "${files[@]}" | sort -V | tail -n 1
)" )"
[[ -n "$match" ]] && printf '%s\n' "$match" [[ -n "$match" ]] && printf '%s\n' "$match"
@@ -75,7 +84,8 @@ find_windows_image() {
windows_iso_path() { windows_iso_path() {
if ! find_windows_image "$install_iso_dir" iso; then if ! find_windows_image "$install_iso_dir" iso; then
printf 'Error: no Windows 11 x64 ISO (*Win*11*x64*.iso) found in %s\n' "$install_iso_dir" >&2 printf 'Error: no Windows 11 %s ISO (*Win*11*%s*.iso) found in %s\n' \
"$windows_arch" "$windows_arch" "$install_iso_dir" >&2
return 1 return 1
fi fi
} }
@@ -88,7 +98,8 @@ windows_qcow2_path() {
iso="$(basename -- "$iso")" iso="$(basename -- "$iso")"
printf '%s/%s.qcow2\n' "$base_qcow2_dir" "${iso%.*}" printf '%s/%s.qcow2\n' "$base_qcow2_dir" "${iso%.*}"
elif ! find_windows_image "$base_qcow2_dir" qcow2; then elif ! find_windows_image "$base_qcow2_dir" qcow2; then
printf 'Error: no Windows 11 x64 ISO (*Win*11*x64*.iso) found in %s\n' "$install_iso_dir" >&2 printf 'Error: no Windows 11 %s ISO (*Win*11*%s*.iso) found in %s\n' \
"$windows_arch" "$windows_arch" "$install_iso_dir" >&2
return 1 return 1
fi fi
} }
@@ -125,7 +136,7 @@ then downloads them again from the beginning.
--print-path prints only the absolute image path without downloading it. --print-path prints only the absolute image path without downloading it.
For windows11 it prints the QCOW2 path by default; add --iso for the ISO path. For windows11 it prints the QCOW2 path by default; add --iso for the ISO path.
The Windows ISO is found automatically in install-iso/ by matching The Windows ISO is found automatically in install-iso/ by matching
*Win*11*x64*.iso; the QCOW2 path is named after that ISO. *Win*11*x64*.iso (*Win*11*arm64*.iso on arm64); the QCOW2 path is named after that ISO.
EOF EOF
} }