Auto-detect host architecture for downloaded images
Debian/AlmaLinux/Fedora image filenames, URLs, and checksums were hardcoded to arm64/aarch64 (for Apple Silicon macOS), which would silently download the wrong-architecture image on an Intel/amd64 host. Detect the architecture from the host (uname -m), normalized to arm64/amd64, with VM_IMAGE_ARCH as an override; the run-*.sh scripts in the parent repo use the same override so both stay in sync. amd64 keeps the previously pinned checksums; arm64 checksums are still unpinned pending upstream publication. windows11 is unaffected: it stays x86_64-only, matching run-windows11.sh. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d2b46066d4
commit
4e86a23634
1 file changed
+44
-10
+44
-10
@@ -5,20 +5,53 @@ images_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
base_qcow2_dir="${images_dir}/base-qcow2"
|
base_qcow2_dir="${images_dir}/base-qcow2"
|
||||||
install_iso_dir="${images_dir}/install-iso"
|
install_iso_dir="${images_dir}/install-iso"
|
||||||
tools_iso_dir="${images_dir}/tools-iso"
|
tools_iso_dir="${images_dir}/tools-iso"
|
||||||
debian_image="${base_qcow2_dir}/debian-13-generic-amd64-20260810-2566.qcow2"
|
|
||||||
alma_image="${base_qcow2_dir}/AlmaLinux-10-GenericCloud-10.2-20260526.0.x86_64.qcow2"
|
normalize_arch() {
|
||||||
fedora_image="${base_qcow2_dir}/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2"
|
case "$1" in
|
||||||
|
arm64|aarch64) printf 'arm64\n' ;;
|
||||||
|
x86_64|amd64) printf 'amd64\n' ;;
|
||||||
|
*) printf 'Error: unsupported architecture: %s\n' "$1" >&2; exit 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
image_arch="$(normalize_arch "${VM_IMAGE_ARCH:-$(uname -m)}")"
|
||||||
|
|
||||||
|
if [[ "$image_arch" == arm64 ]]; then
|
||||||
|
debian_image="${base_qcow2_dir}/debian-13-generic-arm64-20260810-2566.qcow2"
|
||||||
|
alma_image="${base_qcow2_dir}/AlmaLinux-10-GenericCloud-10.2-20260526.0.aarch64.qcow2"
|
||||||
|
fedora_image="${base_qcow2_dir}/Fedora-Cloud-Base-Generic-44-1.7.aarch64.qcow2"
|
||||||
|
debian_url_default="https://cloud.debian.org/images/cloud/trixie/20260810-2566/debian-13-generic-arm64-20260810-2566.qcow2"
|
||||||
|
alma_url_default="https://repo.almalinux.org/almalinux/10/cloud/aarch64/images/AlmaLinux-10-GenericCloud-10.2-20260526.0.aarch64.qcow2"
|
||||||
|
fedora_url_default="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/aarch64/images/Fedora-Cloud-Base-Generic-44-1.7.aarch64.qcow2"
|
||||||
|
# TODO: these were pinned for the amd64/x86_64 builds; verification is
|
||||||
|
# skipped (empty default) for the arm64/aarch64 builds until their
|
||||||
|
# checksums are fetched and pinned via DEBIAN_IMAGE_SHA512 /
|
||||||
|
# ALMA_IMAGE_SHA256 / FEDORA_IMAGE_SHA256.
|
||||||
|
debian_sha512_default=""
|
||||||
|
alma_sha256_default=""
|
||||||
|
fedora_sha256_default=""
|
||||||
|
else
|
||||||
|
debian_image="${base_qcow2_dir}/debian-13-generic-amd64-20260810-2566.qcow2"
|
||||||
|
alma_image="${base_qcow2_dir}/AlmaLinux-10-GenericCloud-10.2-20260526.0.x86_64.qcow2"
|
||||||
|
fedora_image="${base_qcow2_dir}/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2"
|
||||||
|
debian_url_default="https://cloud.debian.org/images/cloud/trixie/20260810-2566/debian-13-generic-amd64-20260810-2566.qcow2"
|
||||||
|
alma_url_default="https://repo.almalinux.org/almalinux/10/cloud/x86_64/images/AlmaLinux-10-GenericCloud-10.2-20260526.0.x86_64.qcow2"
|
||||||
|
fedora_url_default="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2"
|
||||||
|
debian_sha512_default="f6978100d8031c266d55d7815ceea7fcdeacf28e1e5834fdb9c94ac96880a054a6e6f8681c2d3b0584e0057eaf3ef7353856b85212d04134744faa9b3bb1f24f"
|
||||||
|
alma_sha256_default="47f2218668dd4776be140dd92fa3bea700be1766e2c7d88bdfd6a4b50f477b4d"
|
||||||
|
fedora_sha256_default="28680fe5b371a5a82ebf43a31926e086a168e59949d03969c5093e7071f90b7f"
|
||||||
|
fi
|
||||||
|
|
||||||
virtio_image="${tools_iso_dir}/virtio-win.iso"
|
virtio_image="${tools_iso_dir}/virtio-win.iso"
|
||||||
windows_qcow2_image="${base_qcow2_dir}/Win11_25H2_English_x64_v2.qcow2"
|
windows_qcow2_image="${base_qcow2_dir}/Win11_25H2_English_x64_v2.qcow2"
|
||||||
windows_iso_image="${install_iso_dir}/Win11_25H2_English_x64_v2.iso"
|
windows_iso_image="${install_iso_dir}/Win11_25H2_English_x64_v2.iso"
|
||||||
|
|
||||||
debian_url="${DEBIAN_IMAGE_URL:-https://cloud.debian.org/images/cloud/trixie/20260810-2566/debian-13-generic-amd64-20260810-2566.qcow2}"
|
debian_url="${DEBIAN_IMAGE_URL:-$debian_url_default}"
|
||||||
alma_url="${ALMA_IMAGE_URL:-https://repo.almalinux.org/almalinux/10/cloud/x86_64/images/AlmaLinux-10-GenericCloud-10.2-20260526.0.x86_64.qcow2}"
|
alma_url="${ALMA_IMAGE_URL:-$alma_url_default}"
|
||||||
fedora_url="${FEDORA_IMAGE_URL:-https://download.fedoraproject.org/pub/fedora/linux/releases/44/Cloud/x86_64/images/Fedora-Cloud-Base-Generic-44-1.7.x86_64.qcow2}"
|
fedora_url="${FEDORA_IMAGE_URL:-$fedora_url_default}"
|
||||||
virtio_url="${VIRTIO_WIN_ISO_URL:-https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso}"
|
virtio_url="${VIRTIO_WIN_ISO_URL:-https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso}"
|
||||||
debian_sha512="${DEBIAN_IMAGE_SHA512:-f6978100d8031c266d55d7815ceea7fcdeacf28e1e5834fdb9c94ac96880a054a6e6f8681c2d3b0584e0057eaf3ef7353856b85212d04134744faa9b3bb1f24f}"
|
debian_sha512="${DEBIAN_IMAGE_SHA512:-$debian_sha512_default}"
|
||||||
alma_sha256="${ALMA_IMAGE_SHA256:-47f2218668dd4776be140dd92fa3bea700be1766e2c7d88bdfd6a4b50f477b4d}"
|
alma_sha256="${ALMA_IMAGE_SHA256:-$alma_sha256_default}"
|
||||||
fedora_sha256="${FEDORA_IMAGE_SHA256:-28680fe5b371a5a82ebf43a31926e086a168e59949d03969c5093e7071f90b7f}"
|
fedora_sha256="${FEDORA_IMAGE_SHA256:-$fedora_sha256_default}"
|
||||||
force_download=false
|
force_download=false
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@@ -27,7 +60,8 @@ Usage: $(basename "$0") [--force] [all|debian13|almalinux10|fedora44|virtio-win]
|
|||||||
$(basename "$0") --print-path TARGET [--iso]
|
$(basename "$0") --print-path TARGET [--iso]
|
||||||
|
|
||||||
Download one or more shared VM images. With no arguments, all targets are
|
Download one or more shared VM images. With no arguments, all targets are
|
||||||
processed.
|
processed. The Debian/AlmaLinux/Fedora image architecture (arm64 or amd64)
|
||||||
|
is auto-detected from the host; override it with VM_IMAGE_ARCH.
|
||||||
|
|
||||||
--force removes existing files and partial downloads for the selected targets,
|
--force removes existing files and partial downloads for the selected targets,
|
||||||
then downloads them again from the beginning.
|
then downloads them again from the beginning.
|
||||||
|
|||||||
Reference in new issue
Block a user