feat: Use detected architecture for driver fallback (#2084)

This commit is contained in:
Kroese
2026-08-06 20:40:43 +02:00
committed by GitHub
parent 93cab3110d
commit 65fe8ada74
2 changed files with 26 additions and 8 deletions
+9 -6
View File
@@ -521,6 +521,7 @@ checkPlatform() {
local xml="$1" local xml="$1"
local platform local platform
IMAGE_PLATFORM=""
platform=$(getPlatform "$xml") || return 1 platform=$(getPlatform "$xml") || return 1
case "${platform,,}" in case "${platform,,}" in
@@ -535,20 +536,22 @@ checkPlatform() {
case "${PLATFORM,,}" in case "${PLATFORM,,}" in
"x64" ) "x64" )
if [[ "${platform,,}" == "x64" || "${platform,,}" == "x86" ]]; then if [[ "${platform,,}" != "x64" && "${platform,,}" != "x86" ]]; then
return 0 error "You cannot boot ${platform^^} images on a $PLATFORM CPU!"
return 1
fi ;; fi ;;
"arm64" ) "arm64" )
if [[ "${platform,,}" == "arm64" ]]; then if [[ "${platform,,}" != "arm64" ]]; then
return 0 error "You cannot boot ${platform^^} images on a $PLATFORM CPU!"
return 1
fi ;; fi ;;
* ) * )
error "Unsupported container platform: $PLATFORM" error "Unsupported container platform: $PLATFORM"
return 1 ;; return 1 ;;
esac esac
error "You cannot boot ${platform^^} images on a $PLATFORM CPU!" IMAGE_PLATFORM="${platform,,}"
return 1 return 0
} }
getPlatform() { getPlatform() {
+17 -2
View File
@@ -1131,6 +1131,7 @@ addDrivers() {
local version="$2" local version="$2"
local drivers="$stage/drivers" local drivers="$stage/drivers"
local msg="Windows version and architecture are unknown; cannot select drivers!"
rm -rf "$drivers" || return 1 rm -rf "$drivers" || return 1
mkdir -p "$drivers" || return 1 mkdir -p "$drivers" || return 1
@@ -1138,8 +1139,22 @@ addDrivers() {
info "Adding drivers to image..." info "Adding drivers to image..."
if [ -z "$version" ]; then if [ -z "$version" ]; then
version="win11x64"
warn "Windows version unknown, falling back to Windows 11 drivers..." if [ -z "${IMAGE_PLATFORM:-}" ]; then
error "$msg" && return 1
fi
case "${IMAGE_PLATFORM,,}" in
"x86" ) version="win7x86" ;;
"x64" ) version="win11x64" ;;
"arm64" ) version="win11arm64" ;;
* ) error "$msg" && return 1 ;;
esac
local desc
desc=$(printVersion "$version" "") || return 1
warn "Windows version unknown, falling back to $desc drivers..."
fi fi
if ! bsdtar -xf /var/drivers.txz -C "$drivers"; then if ! bsdtar -xf /var/drivers.txz -C "$drivers"; then