ソースを参照

feat(hfserver): add Holdfast: Nations At War server (#5230)

Adds Holdfast: Nations At War (hfserver, appid 1424230).

- Per-instance serverconfig_<instance>.txt copied from the shipped default, server name and admin password set on install; details reads it back.
- Ports: game UDP 20100, Steam query UDP 27000 (gamedig).
- Stop with CTRL+c; requires 2GB RAM.
- check_executable, check_permissions and info_messages strip quotes before basename so an executable name with a space works.

Fixes #4051
Daniel Gibbs 12 時間 前
親
コミット
c1a258ec58

+ 224 - 0
lgsm/config-default/config-lgsm/hfserver/_default.cfg

@@ -0,0 +1,224 @@
+##################################
+######## 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 ####
+
+## Server Settings
+# Server name, passwords, ports, max players and the map rotation are set in the game config.
+# Find its location with: ./hfserver details
+
+## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+# https://wiki.holdfastgame.com/Server_Hosting
+startparameters="-startserver --serverheadless -batchmode -nographics -screen-width 640 -screen-height 480 -screen-quality Fastest -serverConfigFilePath ${servercfgfullpath} -logFile ${gamelog} -logArchivesDirectory logs_archive/ -playersLogFilePath logs_playerlogin/playerlogin_${selfname}.txt -adminCommandsLogFilePath logs_adminactions/adminactions_${selfname}.txt -chatLogFilePath logs_chat/chatlog_${selfname}.txt -scoreboardLogFilePath logs_score/scorelog_${selfname}.txt -vacLogFilePath logs_vac/vaclog_${selfname}.txt -bannedPlayersFilePath bannedplayers.txt -mutedChatPlayersFilePath muteplayerschat.txt -mutedVoipPlayersFilePath muteplayersvoip.txt -micSpammersPlayersFilePath micspammers.txt"
+
+## 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"
+
+# Minutes to wait between repeated monitor alerts, 0 sends every alert
+alertcooldown="0"
+
+# 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"
+
+## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd
+# Server appid
+appid="1424230"
+steamcmdforcewindows="no"
+# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
+branch=""
+betapassword=""
+# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
+steammaster="false"
+
+## 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
+# 12: shutdown
+# 13: soulmask
+# 14: Running With Rifles
+# 15: Rising World
+# 16: Conan Exiles
+stopmode="2"
+
+## Query mode
+# 1: session only
+# 2: gamedig (gsquery fallback)
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="2"
+querytype="protocol-valve"
+
+## Console type
+consoleverbose="no"
+consoleinteract="no"
+
+## Game Server Details
+# Do not edit
+gamename="Holdfast: Nations At War"
+engine="unity3d"
+glibc="2.17"
+
+#### Directories ####
+# Edit with care
+
+## Game Server Directories
+systemdir="${serverfiles}"
+executabledir="${serverfiles}"
+executable="\"./Holdfast NaW\""
+servercfgdir="${serverfiles}"
+servercfg="serverconfig_${selfname}.txt"
+servercfgdefault="serverconfig_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"
+gamelog="${gamelogdir}/${selfname}-game.log"
+lgsmlog="${lgsmlogdir}/${selfname}-script.log"
+consolelog="${consolelogdir}/${selfname}-console.log"
+alertlog="${lgsmlogdir}/${selfname}-alert.log"
+postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
+
+## Logs Naming
+gamelogdate="${gamelogdir}/${selfname}-game-$(date '+%Y-%m-%d-%H:%M:%S').log"
+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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -53,6 +53,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

BIN
lgsm/data/gameicons/hf-icon.png


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

@@ -56,6 +56,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,ncurses-libs.i686
 hcu
+hf
 hl2dm
 hldm
 hldms

+ 1 - 0
lgsm/data/serverlist.csv

@@ -53,6 +53,7 @@ fivem,fivemserver,FiveM,ubuntu-26.04
 fof,fofserver,Fistful of Frags,ubuntu-26.04
 gmod,gmodserver,Garrys Mod,ubuntu-26.04
 hcu,hcuserver,HYPERCHARGE: Unboxed,ubuntu-26.04
+hf,hfserver,Holdfast: Nations At War,ubuntu-26.04
 hl2dm,hl2dmserver,Half-Life 2: Deathmatch,ubuntu-26.04
 hldm,hldmserver,Half-Life: Deathmatch,ubuntu-26.04
 hldms,hldmsserver,Half-Life Deathmatch: Source,ubuntu-26.04

+ 16 - 0
lgsm/data/servers.json

@@ -1200,6 +1200,22 @@
         }
       ]
     },
+    "hfserver": {
+      "ports": [
+        {
+          "label": "Game",
+          "variable": "port",
+          "default": 20100,
+          "protocols": ["udp"]
+        },
+        {
+          "label": "Query",
+          "variable": "queryport",
+          "default": 27000,
+          "protocols": ["udp"]
+        }
+      ]
+    },
     "hl2dmserver": {
       "ports": [
         {

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

@@ -56,6 +56,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -56,6 +56,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod,libtinfo5:i386
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod
 hcu
+hf
 hl2dm
 hldm
 hldms

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

@@ -54,6 +54,7 @@ fivem
 fof
 gmod
 hcu
+hf
 hl2dm
 hldm
 hldms

+ 1 - 1
lgsm/modules/check_executable.sh

@@ -8,7 +8,7 @@
 moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Check if executable exists
-execname=$(basename "${executable}")
+execname=$(basename "${executable//\"/}")
 if [ ! -f "${executabledir}/${execname}" ]; then
 	fn_print_fail_nl "executable was not found"
 	echo -e "* ${executabledir}/${execname}"

+ 1 - 1
lgsm/modules/check_permissions.sh

@@ -106,7 +106,7 @@ fn_check_permissions() {
 
 	# Check if executable is executable and attempt to fix it.
 	# First get executable name.
-	execname=$(basename "${executable}")
+	execname=$(basename "${executable//\"/}")
 	if [ -f "${executabledir}/${execname}" ] && [ ! -x "${executabledir}/${execname}" ]; then
 		# Get permission numbers on file under the form 775.
 		execperm=$(stat -c %a "${executabledir}/${execname}")

+ 2 - 0
lgsm/modules/check_system_requirements.sh

@@ -53,6 +53,8 @@ elif [ "${shortname}" == "rsdw" ]; then
 	ramrequirementgb="2"
 elif [ "${shortname}" == "bfe" ]; then
 	ramrequirementgb="2"
+elif [ "${shortname}" == "hf" ]; then
+	ramrequirementgb="2"
 elif [ "${shortname}" == "rwr" ]; then
 	ramrequirementgb="1"
 elif [ "${shortname}" == "rust" ]; then

+ 27 - 0
lgsm/modules/info_game.sh

@@ -1367,6 +1367,31 @@ fn_info_game_fctr() {
 	fi
 }
 
+# Config Type: custom
+# Parameters: false
+# Comment: #
+# Example: server_name SERVERNAME
+# Filetype: txt
+fn_info_game_hf() {
+	if [ -f "${servercfgfullpath}" ]; then
+		servername="$(sed -n 's/^[[:blank:]]*server_name[[:blank:]]\+\(.*[^[:blank:]#]\)[[:blank:]#]*$/\1/p' "${servercfgfullpath}" | head -n 1)"
+		adminpassword="$(sed -n 's/^[[:blank:]]*server_admin_password[[:blank:]]\+\([^[:blank:]#]*\).*/\1/p' "${servercfgfullpath}" | head -n 1)"
+		serverpassword="$(sed -n 's/^[[:blank:]]*server_password[[:blank:]]\+\([^[:blank:]#]*\).*/\1/p' "${servercfgfullpath}" | head -n 1)"
+		port="$(sed -n 's/^[[:blank:]]*server_port[[:blank:]]\+\([0-9]\+\).*/\1/p' "${servercfgfullpath}" | head -n 1)"
+		queryport="$(sed -n 's/^[[:blank:]]*steam_query_port[[:blank:]]\+\([0-9]\+\).*/\1/p' "${servercfgfullpath}" | head -n 1)"
+		maxplayers="$(sed -n 's/^[[:blank:]]*maximum_players[[:blank:]]\+\([0-9]\+\).*/\1/p' "${servercfgfullpath}" | head -n 1)"
+		defaultmap="$(sed -n 's/^[[:blank:]]*map_name[[:blank:]]\+\([^[:blank:]#]*\).*/\1/p' "${servercfgfullpath}" | head -n 1)"
+		gamemode="$(sed -n 's/^[[:blank:]]*game_mode[[:blank:]]\+\([^[:blank:]#]*\).*/\1/p' "${servercfgfullpath}" | head -n 1)"
+	fi
+	servername="${servername:-"NOT SET"}"
+	adminpassword="${adminpassword:-"NOT SET"}"
+	port="${port:-"0"}"
+	queryport="${queryport:-"0"}"
+	maxplayers="${maxplayers:-"0"}"
+	defaultmap="${defaultmap:-"NOT SET"}"
+	gamemode="${gamemode:-"NOT SET"}"
+}
+
 # Config Type: parameters (json possibly supported)
 # Parameters: true
 # Comment:
@@ -2574,6 +2599,8 @@ elif [ "${shortname}" == "fctr" ]; then
 	fn_info_game_fctr
 elif [ "${shortname}" == "fivem" ]; then
 	fn_info_game_fivem
+elif [ "${shortname}" == "hf" ]; then
+	fn_info_game_hf
 elif [ "${shortname}" == "hw" ]; then
 	fn_info_game_hw
 elif [ "${shortname}" == "hz" ]; then

+ 14 - 2
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" "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")
+	local ports_edit_array=("ac" "arma3" "armar" "bfe" "bo" "bt" "ct" "dst" "eco" "fivem" "hf" "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"
@@ -797,6 +797,8 @@ fn_info_messages_ports() {
 		portcommand="ss -tuplwn | grep ConanSandbox"
 	elif [ "${shortname}" == "dayz" ]; then
 		portcommand="ss -tuplwn | grep enfMain"
+	elif [ "${shortname}" == "hf" ]; then
+		portcommand="ss -tuplwn | grep Holdfast"
 	elif [ "${shortname}" == "q4" ]; then
 		portcommand="ss -tuplwn | grep q4ded.x86"
 	elif [ "${shortname}" == "fivem" ]; then
@@ -818,7 +820,7 @@ fn_info_messages_ports() {
 	elif [ "${engine}" == "goldsrc" ]; then
 		portcommand="ss -tuplwn | grep hlds_linux"
 	else
-		executableshort="$(basename "${executable}" | cut -c -15)"
+		executableshort="$(basename "${executable//\"/}" | cut -c -15)"
 		portcommand="ss -tuplwn | grep ${executableshort}"
 	fi
 	echo -e "${portcommand}"
@@ -1187,6 +1189,14 @@ fn_info_messages_hcu() {
 	} | column -s $'\t' -t
 }
 
+fn_info_messages_hf() {
+	{
+		fn_port "header"
+		fn_port "Game" port udp
+		fn_port "Query" queryport udp
+	} | column -s $'\t' -t
+}
+
 fn_info_messages_hw() {
 	{
 		fn_port "header"
@@ -2047,6 +2057,8 @@ fn_info_messages_select_engine() {
 		fn_info_messages_fivem
 	elif [ "${shortname}" == "hcu" ]; then
 		fn_info_messages_hcu
+	elif [ "${shortname}" == "hf" ]; then
+		fn_info_messages_hf
 	elif [ "${shortname}" == "hw" ]; then
 		fn_info_messages_hw
 	elif [ "${shortname}" == "hz" ]; then

+ 8 - 0
lgsm/modules/install_config.sh

@@ -559,6 +559,14 @@ elif [ "${shortname}" == "hl2dm" ]; then
 	fn_default_config_remote
 	fn_set_config_vars
 	fn_list_config_locations
+elif [ "${shortname}" == "hf" ]; then
+	if [ ! -f "${servercfgfullpath}" ]; then
+		fn_default_config_local
+		echo -e ""
+		sed -i -e "s/^server_name .*/server_name SERVERNAME/" -e "s/^server_admin_password .*/server_admin_password ADMINPASSWORD/" "${servercfgfullpath}"
+		fn_set_config_vars
+	fi
+	fn_list_config_locations
 elif [ "${shortname}" == "hz" ]; then
 	# Config is generated on first run
 	: