feat: Enforce a minimal disk size per Windows version (#2122)

This commit is contained in:
Kroese
2026-08-09 22:16:20 +02:00
committed by GitHub
parent 433c83cab0
commit 7e3e24780d
2 changed files with 69 additions and 11 deletions
+55 -11
View File
@@ -963,27 +963,71 @@ getRequiredMemory() {
case "$id" in case "$id" in
"win11"* ) "win11"* )
echo 2147483648 ;; echo "2G" ;;
"tiny11"* | "core11"* ) "tiny11"* | "core11"* )
echo 2147483648 ;; echo "2G" ;;
"win10"* | "tiny10"* ) "win10"* | "tiny10"* )
echo 2147483648 ;; echo "2G" ;;
"win2025"* | "win2022"* | "win2019"* | "win2016"* ) "win2025"* | "win2022"* | "win2019"* | "win2016"* )
echo 2147483648 ;; echo "2G" ;;
"win81"* | "win7x64"* ) "win81"* | "win7x64"* )
echo 2147483648 ;; echo "2G" ;;
"win7x86"* | "winvista"* | "win2012"* ) "win7x86"* | "winvista"* | "win2012"* )
echo 1073741824 ;; echo "1G" ;;
"win2008"* | "win2003"* ) "win2008"* | "win2003"* )
echo 536870912 ;; echo "512M" ;;
"winxpx64"* ) "winxpx64"* )
echo 268435456 ;; echo "256M" ;;
"win9"* | "winnt4"* | "winxpx86"* | "win2k"* ) "win9"* | "winnt4"* | "winxpx86"* | "win2k"* )
echo 136314880 ;; echo "130M" ;;
"reactos"* ) "reactos"* )
echo 136314880 ;; echo "130M" ;;
* ) * )
echo 136314880 ;; echo "130M" ;;
esac
return 0
}
getRequiredDisk() {
local id="${1,,}"
case "$id" in
"win11"* )
echo "32G" ;;
"tiny11"* )
echo "8G" ;;
"core11"* )
echo "4G" ;;
"win10"* )
echo "16G" ;;
"tiny10"* )
echo "10G" ;;
"win2025"* | "win2022"* | "win2019"* | "win2016"* | "win2012"* )
echo "32G" ;;
"win81"* | "win7"* | "winvista"* )
echo "16G" ;;
"win2008"* )
echo "10G" ;;
"win2003"* )
echo "4G" ;;
"winxp"* )
echo "2G" ;;
"win2k"* )
echo "1G" ;;
"win9x"* )
echo "512M" ;;
"win98"* )
echo "256M" ;;
"win95"* )
echo "100M" ;;
"winnt4"* )
echo "128M" ;;
"reactos"* )
echo "512M" ;;
* )
echo "100M" ;;
esac esac
return 0 return 0
+14
View File
@@ -160,6 +160,8 @@ configureMachine() {
return 79 return 79
fi fi
setDiskMinimum "$DETECTED" || return 79
if ! setMachine "$DETECTED" "$iso" "$dir" "$desc"; then if ! setMachine "$DETECTED" "$iso" "$dir" "$desc"; then
error "Failed to configure the virtual machine for $desc!" error "Failed to configure the virtual machine for $desc!"
return 80 return 80
@@ -401,6 +403,7 @@ startInstall() {
if [ -z "$CUSTOM" ] && [[ "${VERSION,,}" != "http"* ]]; then if [ -z "$CUSTOM" ] && [[ "${VERSION,,}" != "http"* ]]; then
checkMemory "$VERSION" || return 67 checkMemory "$VERSION" || return 67
setDiskMinimum "$VERSION" || return 67
fi fi
# Work from the temporary directory so the persistent source path can # Work from the temporary directory so the persistent source path can
@@ -1454,6 +1457,17 @@ checkMemory() {
return 0 return 0
} }
setDiskMinimum() {
local id="$1"
local required
required=$(getRequiredDisk "$id") || return
DISK_MINIMUM="$required"
return 0
}
restoreBootMode() { restoreBootMode() {
local current="${BOOT_MODE:-}" local current="${BOOT_MODE:-}"