mirror of
https://github.com/dockur/windows.git
synced 2026-08-24 15:48:59 +01:00
feat: Verify required RAM per Windows version (#2085)
This commit is contained in:
+1
-4
@@ -93,11 +93,8 @@ An empty default means the variable is unset and its value is determined automat
|
||||
| `WEB` | `Y` | Enables the web interface. |
|
||||
| `WEB_PORT` | `8006` | Port for the web interface. |
|
||||
| `VNC_PORT` | `5900` | Port for the VNC server. |
|
||||
| `WSS_PORT` | `5700` | WebSocket port used by noVNC. |
|
||||
| `WSD_PORT` | `8004` | Internal websocketd port used for the display stream. |
|
||||
| `AUDIO` | `N` | Streams guest audio to the web viewer. |
|
||||
| `SOUND` | `intel-hda` | QEMU audio device used by the web viewer. |
|
||||
| `AUX_PORT` | `8003` | Internal WebSocket port used for the audio stream. |
|
||||
| `PROTECT` | `N` | Enables password protection for the web interface. |
|
||||
|
||||
## 📁 File Sharing
|
||||
@@ -181,4 +178,4 @@ Also see [Dynamic memory allocation](https://github.com/qemus/qemu/blob/master/d
|
||||
| `LOG` | `N` | Saves all output from `install.bat` to `C:\OEM\install.log` for troubleshooting. |
|
||||
| `DETECTED` | | Overrides the automatically detected Windows image identifier. |
|
||||
| `SERIAL` | `mon:stdio` | QEMU serial device configuration. |
|
||||
| `MONITOR` | `unix:/run/shm/monitor.sock` | QEMU monitor configuration. |
|
||||
| `MONITOR` | | QEMU monitor configuration. |
|
||||
|
||||
+2
-2
@@ -10,7 +10,8 @@ cd /run
|
||||
|
||||
. start.sh # Startup hook
|
||||
. utils.sh # Load functions
|
||||
. reset.sh # Initialize system
|
||||
. init.sh # Initialize system
|
||||
. memory.sh # Check memory
|
||||
. server.sh # Start webserver
|
||||
. define.sh # Define versions
|
||||
. mido.sh # Download Windows
|
||||
@@ -25,7 +26,6 @@ cd /run
|
||||
. boot.sh # Configure boot
|
||||
. proc.sh # Initialize processor
|
||||
. power.sh # Configure shutdown
|
||||
. memory.sh # Check available memory
|
||||
. balloon.sh # Initialize ballooning
|
||||
. config.sh # Configure arguments
|
||||
. finish.sh # Finish initialization
|
||||
|
||||
+3
-35
@@ -1316,45 +1316,13 @@ backupPrevious () {
|
||||
checkMemory() {
|
||||
|
||||
local id="$1"
|
||||
local desc="${2:-}"
|
||||
local required wanted available
|
||||
local required name
|
||||
|
||||
required=$(getRequiredMemory "$id") || return 1
|
||||
|
||||
if [ -z "$desc" ]; then
|
||||
desc=$(printVariant "$id" "$id") || return 1
|
||||
fi
|
||||
|
||||
# Ensure the final memory allocation also uses this floor.
|
||||
RAM_MINIMUM="$required"
|
||||
|
||||
# Refresh host and container memory availability.
|
||||
getMemoryInfo
|
||||
|
||||
available=$(( RAM_AVAIL - RAM_SPARE ))
|
||||
(( available < 0 )) && available=0
|
||||
|
||||
case "${RAM_SIZE,,}" in
|
||||
"max" )
|
||||
wanted="$available" ;;
|
||||
"half" )
|
||||
wanted=$(( RAM_TOTAL / 2 ))
|
||||
(( wanted > available )) && wanted="$available" ;;
|
||||
* )
|
||||
wanted=$(numfmt --from=iec "$RAM_SIZE") || return 1
|
||||
|
||||
if (( wanted < required )); then
|
||||
error "$desc requires at least $(formatBytes "$required") of RAM, but RAM_SIZE is set to $(formatBytes "$wanted")."
|
||||
return 1
|
||||
fi
|
||||
|
||||
(( wanted > available )) && wanted="$available" ;;
|
||||
esac
|
||||
|
||||
if (( wanted < required )); then
|
||||
error "$desc requires at least $(formatBytes "$required") of RAM, but only $(formatBytes "$wanted") can be allocated."
|
||||
return 1
|
||||
fi
|
||||
name=$(printVersion "$id" "") || return 1
|
||||
checkMemoryRequirement "$name"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
+7
-1
@@ -530,8 +530,9 @@ gracefulShutdown() {
|
||||
finish "$code"
|
||||
}
|
||||
|
||||
enableTrap() {
|
||||
|
||||
enabled "$SHUTDOWN" || return 0
|
||||
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"
|
||||
|
||||
# Keep Ctrl-C available to interactive users without installing an unnecessary
|
||||
# SIGINT handler for background/container execution.
|
||||
@@ -541,4 +542,9 @@ fi
|
||||
|
||||
_trap gracefulShutdown SIGTERM SIGHUP SIGABRT SIGQUIT
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"
|
||||
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user