Explorar o código

feat(tm2020server): add Trackmania 2020 server (#5218)

Adds Trackmania 2020 (tm2020server). The dedicated server is downloaded from the official Nadeo CDN as a zip, with updates detected from the download's Last-Modified date. The shipped dedicated_cfg is copied to the instance config on install, and details reads the server name, slots, password and ports from the XML config. Supersedes #4028.

Fixes #4027

Co-authored-by: H3o66 <chris.h3o66@gmail.com>
Daniel Gibbs hai 1 día
pai
achega
ce3e37737c

+ 1 - 0
LICENSE.md

@@ -27,3 +27,4 @@ The following files are not covered by the MIT License above and remain under th
 - `lgsm/data/gameicons/luanti-icon.png`: Luanti icon by erle, licensed under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/). Copied without modification from [Luanti 5.17.0](https://github.com/luanti-org/luanti/blob/5.17.0/misc/luanti-icon-24x24.png); see the [upstream license and attribution](https://github.com/luanti-org/luanti/blob/5.17.0/LICENSE.txt).
 - `lgsm/data/gameicons/bmp-icon.png`: BeamMP logo, copyright BeamMP Ltd. and its contributors, not covered by the MIT License. Resized from the favicon at [beammp.com](https://beammp.com).
 - `lgsm/data/gameicons/mdt-icon.png`: Mindustry icon by Anuken, licensed under [GPL-3.0](https://github.com/Anuken/Mindustry/blob/master/LICENSE), not covered by the MIT License. Resized from [icon.png](https://github.com/Anuken/Mindustry/blob/master/core/assets/icons/icon.png).
+- `lgsm/data/gameicons/tm2020-icon.png`: Trackmania logo, copyright Ubisoft Entertainment and Nadeo, not covered by the MIT License. Resized from the favicon at [trackmania.com](https://www.trackmania.com).

+ 202 - 0
lgsm/config-default/config-lgsm/tm2020server/_default.cfg

@@ -0,0 +1,202 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either:
+# common.cfg - applies settings to every instance.
+# [instance].cfg - applies settings to a specific instance.
+
+#### Game Server Settings ####
+
+## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
+gamesettings="MatchSettings/example.txt"
+
+## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+startparameters="/nodaemon /dedicated_cfg=${servercfg} /game_settings=${gamesettings}"
+
+## Extra Parameters | https://docs.linuxgsm.com/configuration/start-parameters#extra-parameters
+# Added to the end of startparameters.
+extraparams=""
+
+#### LinuxGSM Settings ####
+
+## LinuxGSM Stats
+# Send useful stats to LinuxGSM developers.
+# https://docs.linuxgsm.com/configuration/linuxgsm-stats
+# (on|off)
+stats="off"
+
+## Notification Alerts
+# (on|off)
+
+# Display IP | https://docs.linuxgsm.com/alerts#display-ip
+displayip=""
+
+# More info | https://docs.linuxgsm.com/alerts#more-info
+postalert="off"
+
+# Alert on Start/Stop/Restart
+statusalert="off"
+
+# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://docs.linuxgsm.com/alerts/email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify
+gotifyalert="off"
+gotifytoken="token"
+gotifywebhook="webhook"
+
+# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# ntfy Alerts | https://docs.linuxgsm.com/alerts/ntfy
+ntfyalert="off"
+ntfytopic="LinuxGSM"
+ntfyserver="https://ntfy.sh"
+ntfytoken=""
+ntfyusername=""
+ntfypassword=""
+ntfypriority=""
+ntfytags=""
+
+# Matrix Alerts | https://docs.linuxgsm.com/alerts/matrix
+matrixalert="off"
+matrixhomeserver="matrix.org"
+matrixtoken="accesstoken"
+matrixroom=""
+
+# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+pushoveruserkey="userkey"
+
+# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat
+rocketchatalert="off"
+rocketchatwebhook="webhook"
+
+# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
+slackalert="off"
+slackwebhook="webhook"
+
+# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
+# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring".
+# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help all".
+telegramapi="api.telegram.org"
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+telegramthreadid=""
+telegramsilentnotification="false"
+curlcustomstring=""
+
+## Stop | https://docs.linuxgsm.com/commands/start-stop-restart
+stoponlyifnoplayers="off"
+stoponlyifnoplayersallcommands="on"
+
+## Player Warnings | https://docs.linuxgsm.com/features/player-warnings
+# Minutes to warn players in-game before a stop, restart or update. 0 to disable.
+# e.g. 15 warns at 15, 10, 5, 3 and 1 minutes.
+warnplayerstimer="0"
+
+## Updating | https://docs.linuxgsm.com/commands/update
+updateonstart="off"
+
+## Backup | https://docs.linuxgsm.com/commands/backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://docs.linuxgsm.com/features/logging
+consolelogging="on"
+logdays="7"
+
+## Monitor | https://docs.linuxgsm.com/commands/monitor
+# Query delay time
+querydelay="1"
+
+## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
+ansi="on"
+
+#### Advanced Settings ####
+
+## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
+sleeptime="0.5"
+
+## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
+# 1: tmux kill
+# 2: CTRL+c
+# 3: quit
+# 4: quit 120s
+# 5: stop
+# 6: q
+# 7: exit
+# 8: 7 Days to Die
+# 9: GoldSrc
+# 10: Avorion
+# 11: end
+stopmode="2"
+
+## Query mode
+# 1: session only
+# 2: gamedig (gsquery fallback)
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="5"
+querytype=""
+
+## Console type
+consoleverbose="yes"
+consoleinteract="yes"
+
+## Game Server Details
+# Do not edit
+gamename="Trackmania 2020"
+engine="maniaplanet"
+glibc="2.18"
+
+#### Directories ####
+# Edit with care
+
+## Game Server Directories
+systemdir="${serverfiles}"
+executabledir="${serverfiles}"
+executable="./TrackmaniaServer"
+servercfgdir="${systemdir}/UserData/Config"
+servercfg="${selfname}.txt"
+servercfgdefault="dedicated_cfg.default.txt"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${lgsmdir}/backup"
+
+## Logging Directories
+[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || logdir="${rootdir}/log"
+gamelogdir="${logdir}/server"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${selfname}-script.log"
+consolelog="${consolelogdir}/${selfname}-console.log"
+alertlog="${lgsmlogdir}/${selfname}-alert.log"
+postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
+
+## Log Parameters
+logtimestamp="off"
+logtimestampformat="%Y-%m-%d %H:%M:%S"

+ 1 - 0
lgsm/data/almalinux-8.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/almalinux-9.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/centos-7.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/centos-8.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/centos-9.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/debian-10.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/debian-11.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/debian-12.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/debian-13.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/debian-9.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

BIN=BIN
lgsm/data/gameicons/tm2020-icon.png


+ 1 - 0
lgsm/data/rhel-7.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/rhel-8.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/rhel-9.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/rocky-8.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/rocky-9.csv

@@ -130,6 +130,7 @@ tf2,libcurl.i686
 tf2c,libcurl.i686
 tfc
 ti
+tm2020,libxml2
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/serverlist.csv

@@ -129,6 +129,7 @@ tf2,tf2server,Team Fortress 2,ubuntu-26.04
 tf2c,tf2cserver,Team Fortress 2 Classified,ubuntu-26.04
 tfc,tfcserver,Team Fortress Classic,ubuntu-26.04
 ti,tiserver,The Isle,ubuntu-26.04
+tm2020,tm2020server,Trackmania 2020,ubuntu-26.04
 ts,tsserver,The Specialists,ubuntu-26.04
 ts3,ts3server,Teamspeak 3,ubuntu-26.04
 tu,tuserver,Tower Unite,ubuntu-26.04

+ 1 - 0
lgsm/data/ubuntu-16.04.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/ubuntu-18.04.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/ubuntu-20.04.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/ubuntu-22.04.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/ubuntu-23.04.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/ubuntu-23.10.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/ubuntu-24.04.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 1 - 0
lgsm/data/ubuntu-26.04.csv

@@ -130,6 +130,7 @@ tf2,libcurl4-gnutls-dev:i386
 tf2c,libcurl4-gnutls-dev:i386
 tfc
 ti
+tm2020,libxml2-utils
 ts
 ts3
 tu

+ 2 - 0
lgsm/modules/command_check_update.sh

@@ -34,6 +34,8 @@ elif [ "${shortname}" == "jk2" ]; then
 	update_jk2.sh
 elif [ "${shortname}" == "jk3" ]; then
 	update_jk3.sh
+elif [ "${shortname}" == "tm2020" ]; then
+	update_tm2020.sh
 elif [ "${shortname}" == "bmp" ]; then
 	update_bmp.sh
 elif [ "${shortname}" == "mdt" ]; then

+ 2 - 0
lgsm/modules/command_update.sh

@@ -76,6 +76,8 @@ elif [ "${shortname}" == "jk2" ]; then
 	update_jk2.sh
 elif [ "${shortname}" == "jk3" ]; then
 	update_jk3.sh
+elif [ "${shortname}" == "tm2020" ]; then
+	update_tm2020.sh
 elif [ "${shortname}" == "bmp" ]; then
 	update_bmp.sh
 elif [ "${shortname}" == "mdt" ]; then

+ 5 - 0
lgsm/modules/core_modules.sh

@@ -874,6 +874,11 @@ update_mdt.sh() {
 	fn_fetch_module
 }
 
+update_tm2020.sh() {
+	modulefile="${FUNCNAME[0]}"
+	fn_fetch_module
+}
+
 update_bmp.sh() {
 	modulefile="${FUNCNAME[0]}"
 	fn_fetch_module

+ 21 - 0
lgsm/modules/info_game.sh

@@ -2326,6 +2326,25 @@ fn_info_game_mdt() {
 	servername="${servername:-"NOT SET"}"
 }
 
+# Config Type: XML
+# Comment: <!-- -->
+fn_info_game_maniaplanet() {
+	if [ -f "${servercfgfullpath}" ]; then
+		fn_info_game_xml "servername" "/dedicated/server_options/name"
+		fn_info_game_xml "maxplayers" "/dedicated/server_options/max_players"
+		fn_info_game_xml "serverpassword" "/dedicated/server_options/password"
+		fn_info_game_xml "configip" "/dedicated/system_config/bind_ip_address"
+		fn_info_game_xml "port" "/dedicated/system_config/server_port"
+		fn_info_game_xml "queryport" "/dedicated/system_config/xmlrpc_port"
+	fi
+	servername="${servername:-"NOT SET"}"
+	maxplayers="${maxplayers:-"32"}"
+	serverpassword="${serverpassword:-"NOT SET"}"
+	configip="${configip:-"0.0.0.0"}"
+	port="${port:-"2350"}"
+	queryport="${queryport:-"5000"}"
+}
+
 # Config Type: TOML (key value pairs)
 # Comment: #
 fn_info_game_bmp() {
@@ -2682,6 +2701,8 @@ elif [ "${shortname}" == "vein" ]; then
 	fn_info_game_vein
 elif [ "${shortname}" == "vh" ]; then
 	fn_info_game_vh
+elif [ "${engine}" == "maniaplanet" ]; then
+	fn_info_game_maniaplanet
 elif [ "${shortname}" == "bmp" ]; then
 	fn_info_game_bmp
 elif [ "${shortname}" == "mdt" ]; then

+ 12 - 1
lgsm/modules/info_messages.sh

@@ -760,7 +760,7 @@ fn_info_messages_ports_edit() {
 
 	startparameterslocation="${red}UNKNOWN${default}"
 	# engines/games that require editing in the config file.
-	local ports_edit_array=("ac" "arma3" "armar" "bfe" "bo" "bt" "ct" "dst" "eco" "fivem" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "mcb" "nec" "pc" "pc2" "prism3d" "pz" "qw" "refractor" "renderware" "rw" "rwr" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "xnt" "wurm")
+	local ports_edit_array=("ac" "arma3" "armar" "bfe" "bo" "bt" "ct" "dst" "eco" "fivem" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "maniaplanet" "mcb" "nec" "pc" "pc2" "prism3d" "pz" "qw" "refractor" "renderware" "rw" "rwr" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "xnt" "wurm")
 	for port_edit in "${ports_edit_array[@]}"; do
 		if [ "${shortname}" == "ut3" ]; then
 			startparameterslocation="${servercfgdir}/UTWeb.ini"
@@ -1880,6 +1880,15 @@ fn_info_messages_mdt() {
 	} | column -s $'\t' -t
 }
 
+fn_info_messages_maniaplanet() {
+	{
+		fn_port "header"
+		fn_port "Game" port tcp
+		fn_port "Game" port udp
+		fn_port "XML-RPC" queryport tcp
+	} | column -s $'\t' -t
+}
+
 fn_info_messages_bmp() {
 	{
 		fn_port "header"
@@ -2120,6 +2129,8 @@ fn_info_messages_select_engine() {
 		fn_info_messages_vein
 	elif [ "${shortname}" == "vh" ]; then
 		fn_info_messages_vh
+	elif [ "${engine}" == "maniaplanet" ]; then
+		fn_info_messages_maniaplanet
 	elif [ "${shortname}" == "bmp" ]; then
 		fn_info_messages_bmp
 	elif [ "${shortname}" == "mdt" ]; then

+ 8 - 1
lgsm/modules/install_config.sh

@@ -256,7 +256,14 @@ fn_list_config_locations() {
 	echo -e "Config documentation: ${italic}https://docs.linuxgsm.com/configuration${default}"
 }
 
-if [ "${shortname}" == "bmp" ]; then
+if [ "${shortname}" == "tm2020" ]; then
+	array_configs+=(dedicated_cfg.default.txt)
+	fn_default_config_remote
+	fn_set_config_vars
+	echo -e "Trackmania 2020 requires a dedicated server account from ${italic}https://www.trackmania.com/${default}"
+	echo -e "Set login and password in the masterserver_account section of ${servercfgfullpath}"
+	fn_list_config_locations
+elif [ "${shortname}" == "bmp" ]; then
 	array_configs+=(ServerConfig.toml)
 	fn_default_config_remote
 	fn_set_config_vars

+ 2 - 0
lgsm/modules/install_server_files.sh

@@ -273,6 +273,8 @@ elif [ "${shortname}" == "jk2" ]; then
 	update_jk2.sh
 elif [ "${shortname}" == "jk3" ]; then
 	update_jk3.sh
+elif [ "${shortname}" == "tm2020" ]; then
+	update_tm2020.sh
 elif [ "${shortname}" == "bmp" ]; then
 	update_bmp.sh
 elif [ "${shortname}" == "mdt" ]; then

+ 140 - 0
lgsm/modules/update_tm2020.sh

@@ -0,0 +1,140 @@
+#!/bin/bash
+# LinuxGSM update_tm2020.sh module
+# Author: Daniel Gibbs
+# Contributors: https://linuxgsm.com/contrib
+# Website: https://linuxgsm.com
+# Description: Handles updating of Trackmania 2020 servers.
+
+moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+fn_update_dl() {
+	fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash"
+	fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}"
+	chmod +x "${executabledir}/${executable#./}"
+	echo "${remotebuild}" > "${serverfiles}/.tm2020-build"
+	fn_clear_tmp
+}
+
+fn_update_localbuild() {
+	local mode="${1:-}"
+	if [ "${mode}" != "silent" ]; then
+		fn_print_dots "Checking local build: ${remotelocation}"
+	fi
+	localbuild=$(cat "${serverfiles}/.tm2020-build" 2> /dev/null)
+	localbuild="${localbuild:-0}"
+	if [ "${mode}" != "silent" ]; then
+		fn_print_ok "Checking local build: ${remotelocation}"
+	fi
+}
+
+fn_update_remotebuild() {
+	remotebuildurl="https://nadeo-download.cdn.ubi.com/trackmania/TrackmaniaServer_Latest.zip"
+	remotebuildfilename="TrackmaniaServer_Latest.zip"
+	apiurl="${remotebuildurl}"
+	remotebuildheader=$(curl -fsSIL --retry 3 "${remotebuildurl}" | tr -d '\r' | awk -F': ' 'tolower($1) == "last-modified" {print $2}' | tail -n 1)
+	remotebuild=$(date -u -d "${remotebuildheader}" '+%Y-%m-%d %H:%M:%S' 2> /dev/null)
+	if [ -z "${remotebuild}" ]; then
+		fn_print_fail_nl "Unable to get the Trackmania 2020 server build date"
+		fn_script_log_fail "Unable to get the Trackmania 2020 server build date"
+		core_exit.sh
+	fi
+}
+
+fn_update_compare() {
+	fn_print_dots "Checking for update: ${remotelocation}"
+	# Update has been found or force update.
+	if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
+		# Create update lockfile.
+		date '+%s' > "${lockdir:?}/update.lock"
+		fn_print_ok_nl "Checking for update: ${remotelocation}"
+		fn_print "\n"
+		fn_print_nl "${bold}${underline}Update${default} available"
+		fn_print_nl "* Local build: ${red}${localbuild}${default}"
+		fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
+		if [ -n "${branch}" ]; then
+			fn_print_nl "* Branch: ${branch}"
+		fi
+		if [ -f "${rootdir}/.dev-debug" ]; then
+			fn_print_nl "Remote build info"
+			fn_print_nl "* apiurl: ${apiurl}"
+			fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
+			fn_print_nl "* remotebuildurl: ${remotebuildurl}"
+			fn_print_nl "* remotebuild: ${remotebuild}"
+		fi
+		fn_print "\n"
+		fn_script_log_info "Update available"
+		fn_script_log_info "Local build: ${localbuild}"
+		fn_script_log_info "Remote build: ${remotebuild}"
+		if [ -n "${branch}" ]; then
+			fn_script_log_info "Branch: ${branch}"
+		fi
+		fn_script_log_info "${localbuild} > ${remotebuild}"
+
+		if [ "${commandname}" == "UPDATE" ]; then
+			# Keep track of the build before updating for alert purposes.
+			previousbuild="${localbuild}"
+			unset updateonstart
+			fn_update_apply fn_update_dl
+			# Refresh local build value after update (silent) so alerts show new version.
+			fn_update_localbuild silent
+			# Verify the update applied correctly unless forced update to same version.
+			if [ "${localbuild}" != "${remotebuild}" ]; then
+				# If forced update and version unchanged treat as acceptable; otherwise failure.
+				if [ "${forceupdate}" != "1" ] || [ "${previousbuild}" = "${localbuild}" ]; then
+					fn_script_log_error "Update verification failed: expected ${remotebuild}, got ${localbuild}"
+					fn_print_fail_nl "Update verification failed: expected ${remotebuild}, got ${localbuild}"
+					updatefailureexpected="${remotebuild}"
+					updatefailuregot="${localbuild}"
+					alert="update-failed"
+					alert.sh
+					core_exit.sh
+				fi
+			else
+				fn_script_log_pass "Update verification success: ${previousbuild} -> ${localbuild}"
+			fi
+			unset exitbypass
+			alert="update"
+		elif [ "${commandname}" == "CHECK-UPDATE" ]; then
+			alert="check-update"
+		fi
+		alert.sh
+	else
+		fn_print_ok_nl "Checking for update: ${remotelocation}"
+		fn_print "\n"
+		fn_print_nl "${bold}${underline}No update${default} available"
+		fn_print_nl "* Local build: ${green}${localbuild}${default}"
+		fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
+		if [ -n "${branch}" ]; then
+			fn_print_nl "* Branch: ${branch}"
+		fi
+		fn_print "\n"
+		fn_script_log_info "No update available"
+		fn_script_log_info "Local build: ${localbuild}"
+		fn_script_log_info "Remote build: ${remotebuild}"
+		if [ -n "${branch}" ]; then
+			fn_script_log_info "Branch: ${branch}"
+		fi
+		if [ -f "${rootdir}/.dev-debug" ]; then
+			fn_print_nl "Remote build info"
+			fn_print_nl "* apiurl: ${apiurl}"
+			fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
+			fn_print_nl "* remotebuildurl: ${remotebuildurl}"
+			fn_print_nl "* remotebuild: ${remotebuild}"
+		fi
+	fi
+}
+
+# The location where the builds are checked and downloaded.
+remotelocation="nadeo-download.cdn.ubi.com"
+
+if [ "${firstcommandname}" == "INSTALL" ]; then
+	fn_update_remotebuild
+	fn_update_dl
+else
+	fn_print_dots "Checking for update"
+	fn_print_dots "Checking for update: ${remotelocation}"
+	fn_script_log_info "Checking for update: ${remotelocation}"
+	fn_update_localbuild
+	fn_update_remotebuild
+	fn_update_compare
+fi