Procházet zdrojové kódy

fix(ndserver): download Nuclear Dawn game content from app 17710 (#5040)

App 111710 only ships the Linux server binaries. Its content depot
17711 is a shared install from the Nuclear Dawn game app (17710), which
SteamCMD records under SharedDepots and never downloads, so servers
fail with "Unable to find gameinfo.txt". app_update 17710 does not work
either, as SteamCMD treats it as shared only.

Require a Steam account that owns Nuclear Dawn and add fix_nd.sh, run
post install and pre start, which downloads depot 17711 with
download_depot when gameinfo.txt is missing and merges it into
serverfiles without overwriting the server files. app_info_print is run
first as download_depot fails with "missing app info" on a cold cache.

Fixes #5039
Daniel Gibbs před 4 dny
rodič
revize
05bae92651

+ 5 - 0
lgsm/config-default/config-lgsm/ndserver/_default.cfg

@@ -8,6 +8,11 @@
 
 #### Game Server Settings ####
 
+## SteamCMD Login | https://docs.linuxgsm.com/steamcmd#steamcmd-login
+# The Steam account must own Nuclear Dawn. The server game content is part of the game.
+steamuser="username"
+steampass='password'
+
 ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
 ip="0.0.0.0"
 port="27015"

+ 5 - 0
lgsm/modules/core_modules.sh

@@ -438,6 +438,11 @@ fix_mta.sh() {
 	fn_fetch_module
 }
 
+fix_nd.sh() {
+	modulefile="${FUNCNAME[0]}"
+	fn_fetch_module
+}
+
 fix_nmrih.sh() {
 	modulefile="${FUNCNAME[0]}"
 	fn_fetch_module

+ 2 - 2
lgsm/modules/fix.sh

@@ -53,8 +53,8 @@ fn_apply_fix() {
 	fi
 }
 
-apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins ios kf nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm xnt zmr)
-apply_post_install_fix=(av kf kf2 ro ut2k4 ut ut3)
+apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins ios kf nd nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm xnt zmr)
+apply_post_install_fix=(av kf kf2 nd ro ut2k4 ut ut3)
 
 # validate registered fixes for safe development
 for fix in "${apply_pre_start_fix[@]}" "${apply_post_install_fix[@]}"; do

+ 38 - 0
lgsm/modules/fix_nd.sh

@@ -0,0 +1,38 @@
+#!/bin/bash
+# LinuxGSM fix_nd.sh module
+# Author: Daniel Gibbs
+# Contributors: https://linuxgsm.com/contrib
+# Website: https://linuxgsm.com
+# Description: Resolves issues with Nuclear Dawn.
+
+moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+if [ ! -f "${serverfiles}/nucleardawn/gameinfo.txt" ]; then
+	fixname="game content"
+	fn_fix_msg_start_nl
+	steamcmdlog="${lgsmlogdir}/${selfname}-steamcmd.log"
+	rm -f "${steamcmdlog:?}"
+	if [ -d "${steamcmddir}" ]; then
+		cd "${steamcmddir}" || exit
+	fi
+	"${steamcmdcommand}" +login "${steamuser}" "${steampass}" +app_info_print 17710 +quit > /dev/null 2>&1
+	"${steamcmdcommand}" +login "${steamuser}" "${steampass}" +download_depot 17710 17711 +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
+	ndcontentdepot="$(grep -o 'Depot download complete : "[^"]*"' "${steamcmdlog}" | tail -1 | cut -d'"' -f2 | tr '\134' '/')"
+	if [[ "${ndcontentdepot}" == */depot_17711 ]]; then
+		if [ -f "${ndcontentdepot}/nucleardawn/gameinfo.txt" ]; then
+			tar -C "${ndcontentdepot}" -cf - . | tar -C "${serverfiles}" -xf - --skip-old-files
+		fi
+		rm -rf "${ndcontentdepot:?}" "${ndcontentdepot%/*}/state_17710_17711.patch"
+	fi
+	if [ -f "${serverfiles}/nucleardawn/gameinfo.txt" ]; then
+		exitcode=0
+	else
+		exitcode=1
+	fi
+	fn_fix_msg_end
+	if [ "${exitcode}" -ne 0 ]; then
+		fn_print_nl "* Nuclear Dawn game content requires a Steam account that owns Nuclear Dawn."
+		fn_print_nl "* Set steamuser and steampass in ${configdirserver}"
+		core_exit.sh
+	fi
+fi