From 5480886f92d9ee31f60340645867f5cb6da66990 Mon Sep 17 00:00:00 2001 From: Robert Thomas <31854736+wolveix@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:08:53 +0100 Subject: [PATCH] Allow VM override (#294) --- Dockerfile | 3 ++- README.md | 35 ++++++++++++++++++----------------- init.sh | 12 ++++++++++++ 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8bdb84c..8e5271b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,8 @@ ENV AUTOSAVENUM="5" \ SKIPUPDATE="false" \ STEAMAPPID="1690800" \ STEAMBETA="false" \ - TIMEOUT="30" + TIMEOUT="30" \ + VMOVERRIDE="false" EXPOSE 7777/udp 7777/tcp diff --git a/README.md b/README.md index 7bbdec4..5d62249 100644 --- a/README.md +++ b/README.md @@ -163,23 +163,24 @@ helm install satisfactory k8s-at-home/satisfactory -f values.yaml ## Environment Variables -| Parameter | Default | Function | -|-------------------------|:---------:|-----------------------------------------------------| -| `AUTOSAVENUM` | `5` | number of rotating autosave files | -| `DEBUG` | `false` | for debugging the server | -| `DISABLESEASONALEVENTS` | `false` | disable the FICSMAS event (you miserable bastard) | -| `MAXOBJECTS` | `2162688` | set the object limit for your server | -| `MAXPLAYERS` | `4` | set the player limit for your server | -| `MAXTICKRATE` | `30` | set the maximum sim tick rate for your server | -| `PGID` | `1000` | set the group ID of the user the server will run as | -| `PUID` | `1000` | set the user ID of the user the server will run as | -| `ROOTLESS` | `false` | run the container as a non-root user | -| `SERVERGAMEPORT` | `7777` | set the game's port | -| `SERVERIP` | `0.0.0.0` | set the game's ip (usually not needed) | -| `SERVERSTREAMING` | `true` | toggle whether the game utilizes asset streaming | -| `SKIPUPDATE` | `false` | avoid updating the game on container start/restart | -| `STEAMBETA` | `false` | set experimental game version | -| `TIMEOUT` | `30` | set client timeout (in seconds) | +| Parameter | Default | Function | +|-------------------------|:---------:|-----------------------------------------------------------| +| `AUTOSAVENUM` | `5` | number of rotating autosave files | +| `DEBUG` | `false` | for debugging the server | +| `DISABLESEASONALEVENTS` | `false` | disable the FICSMAS event (you miserable bastard) | +| `MAXOBJECTS` | `2162688` | set the object limit for your server | +| `MAXPLAYERS` | `4` | set the player limit for your server | +| `MAXTICKRATE` | `30` | set the maximum sim tick rate for your server | +| `PGID` | `1000` | set the group ID of the user the server will run as | +| `PUID` | `1000` | set the user ID of the user the server will run as | +| `ROOTLESS` | `false` | run the container as a non-root user | +| `SERVERGAMEPORT` | `7777` | set the game's port | +| `SERVERIP` | `0.0.0.0` | set the game's ip (usually not needed) | +| `SERVERSTREAMING` | `true` | toggle whether the game utilizes asset streaming | +| `SKIPUPDATE` | `false` | avoid updating the game on container start/restart | +| `STEAMBETA` | `false` | set experimental game version | +| `TIMEOUT` | `30` | set client timeout (in seconds) | +| `VMOVERRIDE` | `false` | skips the CPU model check (should not ordinarily be used) | ## Experimental Branch diff --git a/init.sh b/init.sh index 8abad68..a31c4a7 100755 --- a/init.sh +++ b/init.sh @@ -29,6 +29,18 @@ HDD: $(df -h | awk '$NF=="/"{printf "%dGB/%dGB (%s used)\n", $3,$2,$5}')" exit 1 fi +# check that the cpu isn't generic, as Satisfactory will normally crash +if [[ "$VMOVERRIDE" == "true" ]]; then + printf "${MSGWARNING} VMOVERRIDE is enabled, skipping CPU model check. Satisfactory might crash!\\n" +else + # Perform CPU model check + if [[ "$cpu_model" == "Common KVM processor" || "$cpu_model" == *"QEMU"* ]]; then + printf "${MSGERROR} Your CPU model is configured as \"${cpu_model}\", which will cause Satisfactory to crash.\\nIf you have control over your hypervisor (ESXi, Proxmox, etc.), you should be able to easily change this.\\nOtherwise contact your host/administrator for assistance.\\n" + exit 1 + fi +fi + + # check that the cpu isn't generic, as Satisfactory will crash cpu_model=$(lscpu | grep 'Model name:' | sed 's/Model name:[[:space:]]*//g') if [[ "$cpu_model" == "Common KVM processor" || "$cpu_model" == *"QEMU"* ]]; then