diff --git a/docs/environment.md b/docs/environment.md index 17a3bcbe..7fd693aa 100644 --- a/docs/environment.md +++ b/docs/environment.md @@ -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. | diff --git a/src/entry.sh b/src/entry.sh index 8c08859e..fb8a39be 100644 --- a/src/entry.sh +++ b/src/entry.sh @@ -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 diff --git a/src/install.sh b/src/install.sh index 3bbd9c88..309b5ff7 100644 --- a/src/install.sh +++ b/src/install.sh @@ -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 } diff --git a/src/power.sh b/src/power.sh index 08aafa1e..a178e94f 100644 --- a/src/power.sh +++ b/src/power.sh @@ -530,15 +530,21 @@ gracefulShutdown() { finish "$code" } -enabled "$SHUTDOWN" || return 0 +enableTrap() { + + enabled "$SHUTDOWN" || return 0 + + # Keep Ctrl-C available to interactive users without installing an unnecessary + # SIGINT handler for background/container execution. + if interactive; then + _trap gracefulShutdown SIGINT + fi + + _trap gracefulShutdown SIGTERM SIGHUP SIGABRT SIGQUIT + + 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. -if interactive; then - _trap gracefulShutdown SIGINT -fi - -_trap gracefulShutdown SIGTERM SIGHUP SIGABRT SIGQUIT - return 0