From 27d4a5de408fc50ceedd7e17be6bff50dcc96fb5 Mon Sep 17 00:00:00 2001 From: SlimyC Date: Sat, 30 May 2026 13:29:06 +0200 Subject: [PATCH] feat: add option to choose Nitrox version --- README.md | 5 ++++- docker-compose.yml | 1 + install-nitrox.sh | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c24873..ccbe9de 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # [FuzzyStatic/nitrox-server](https://github.com/FuzzyStatic/nitrox-server) -[Nitrox](https://github.com/SubnauticaNitrox/Nitrox) is an open-source, multiplayer modification for the game [Subnautica](https://unknownworlds.com/subnautica/). Visit the official Nitrox website [here](https://nitrox.rux.gg/download). Currently, this container pulls the latest Nitrox Server upon deployment. +[Nitrox](https://github.com/SubnauticaNitrox/Nitrox) is an open-source, multiplayer modification for the game [Subnautica](https://unknownworlds.com/subnautica/). Visit the official Nitrox website [here](https://nitrox.rux.gg/download). Currently, by default this container pulls the latest Nitrox Server upon deployment. ## Usage @@ -25,6 +25,7 @@ services: - "TZ=Etc/UTC" # The timezone to run Nitrox with (default=Etc/UTC) - "SUBNAUTICA_INSTALLATION_PATH=/subnautica" # The path on the container where 'Subnautica_Data' directory is (default=/subnautica) - "SUBNAUTICA_SAVE=My World" # Set this to your desired save name (default=My World) + - "NITROX_VERSION=latest" # Set this to change the Nitrox version used, e.g. NITROX_VERSION=1.8.1.0 (default=latest) - "CUSTOM_NITROX_REPOSITORY=SubnauticaNitrox/Nitrox" # Set this to the fork you want to use (default=SubnauticaNitrox/Nitrox) ports: - "11000:11000/udp" # Nitrox @@ -40,6 +41,7 @@ docker run -d \ -e PGID=1000 \ -e TZ=Etc/UTC \ -e SUBNAUTICA_INSTALLATION_PATH=/subnautica \ + -e NITROX_VERSION=latest \ -p 11000:11000/udp \ -v /path/to/nitrox:/config \ -v /path/to/subnautica:/subnautica \ @@ -58,6 +60,7 @@ Container images are configured using parameters passed at runtime (such as thos | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | | `-e SUBNAUTICA_INSTALLATION_PATH=/subnautica` | Subnautica game data (on the container). | +| `-e NITROX_VERSION=latest` | Nitrox server version. | | `-v /config` | Nitrox server data storage location. | | `-v /subnautica` | Subnautica game data goes here. | diff --git a/docker-compose.yml b/docker-compose.yml index cb78372..2444a12 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,7 @@ services: - "TZ=Etc/UTC" # The timezone to run Nitrox with (default=Etc/UTC) - "SUBNAUTICA_INSTALLATION_PATH=/subnautica" # The timezone to run Nitrox with (default=/subnautica) - "SUBNAUTICA_SAVE=My World" # Set this to your desired save name (default=My World) (Optional) + - "NITROX_VERSION=latest" # Set this to change the Nitrox version used, e.g. NITROX_VERSION=1.8.1.0 (default=latest) - "CUSTOM_NITROX_REPOSITORY=SubnauticaNitrox/Nitrox" # Set this to the fork you want to use (default=SubnauticaNitrox/Nitrox) ports: - "11000:11000/udp" # Nitrox diff --git a/install-nitrox.sh b/install-nitrox.sh index a4ef85c..fc400f8 100755 --- a/install-nitrox.sh +++ b/install-nitrox.sh @@ -1,10 +1,19 @@ #!/bin/bash -# Download the latest release -echo "Downloading latest Nitrox release..." +# Download Nitrox +echo "Downloading Nitrox release..." mkdir --parents /config/packages cd /config/packages -curl --silent https://api.github.com/repos/"${CUSTOM_NITROX_REPOSITORY:-"SubnauticaNitrox/Nitrox"}"/releases/latest \ + +shopt -s nocasematch; +if [[ "${NITROX_VERSION:-"latest"}" =~ "latest" ]] +then + NITROX_URL=https://api.github.com/repos/"${CUSTOM_NITROX_REPOSITORY:-"SubnauticaNitrox/Nitrox"}"/releases/latest +else + NITROX_URL=https://api.github.com/repos/"${CUSTOM_NITROX_REPOSITORY:-"SubnauticaNitrox/Nitrox"}"/releases/tags/"${NITROX_VERSION:-"latest"}" +fi + +curl --silent "$NITROX_URL" \ | grep -wo "https.*linux_x64.zip" \ | wget --output-document ./nitrox.zip --quiet --input-file -