Преглед изворни кода

fix(ahl): run Action Half-Life on ReHLDS to stop the startup segfault (#5150)

Daniel Gibbs пре 2 дана
родитељ
комит
c5efe90fed

+ 1 - 1
lgsm/config-default/config-lgsm/ahlserver/_default.cfg

@@ -150,7 +150,7 @@ appid="90"
 steamcmdforcewindows="no"
 appidmod="cstrike"
 # SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
-branch=""
+branch="steam_legacy"
 betapassword=""
 # Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
 steammaster="true"

+ 3 - 0
lgsm/modules/command_start.sh

@@ -280,6 +280,9 @@ if [ "${updateonstart}" == "yes" ] || [ "${updateonstart}" == "1" ] || [ "${upda
 		fn_print_warn_nl "Update failed, starting ${servername} anyway"
 		fn_script_log_warn "Update failed, starting ${servername} anyway"
 	fi
+	if [ "${shortname}" == "ahl" ]; then
+		fix_ahl.sh
+	fi
 fi
 
 fn_print_dots "${servername}"

+ 5 - 0
lgsm/modules/core_modules.sh

@@ -368,6 +368,11 @@ fix.sh() {
 	fn_fetch_module
 }
 
+fix_ahl.sh() {
+	modulefile="${FUNCNAME[0]}"
+	fn_fetch_module
+}
+
 fix_ark.sh() {
 	modulefile="${FUNCNAME[0]}"
 	fn_fetch_module

+ 1 - 1
lgsm/modules/fix.sh

@@ -53,7 +53,7 @@ fn_apply_fix() {
 	fi
 }
 
-apply_pre_start_fix=(arma3 armar ark av bf1942 bfv bt bo csgo cmw cod cod2 coduo codwaw ct dst hw ins ios kf nd nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts ts3 mcb mohaa mta unt ut ut99 vh vs wurm xnt zmr)
+apply_pre_start_fix=(ahl arma3 armar ark av bf1942 bfv bt bo csgo cmw cod cod2 coduo codwaw ct dst hw ins ios kf nd nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts ts3 mcb mohaa mta unt ut ut99 vh vs wurm xnt zmr)
 apply_post_install_fix=(av kf kf2 nd ro ut2k4 ut3)
 
 # validate registered fixes for safe development

+ 29 - 0
lgsm/modules/fix_ahl.sh

@@ -0,0 +1,29 @@
+#!/bin/bash
+# LinuxGSM fix_ahl.sh module
+# Author: Daniel Gibbs
+# Contributors: https://linuxgsm.com/contrib
+# Website: https://linuxgsm.com
+# Description: Resolves issues with Action Half-Life.
+
+# shellcheck disable=SC2034 # Used by the module loader.
+moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+export GLIBC_TUNABLES="${GLIBC_TUNABLES:+${GLIBC_TUNABLES}:}glibc.rtld.execstack=2"
+
+rehldsversion="3.15.0.896"
+rehldsfile="rehlds-bin-${rehldsversion}.zip"
+
+if ! grep -qs '"BetaKey"[[:space:]]*"steam_legacy"' "${serverfiles}/steamapps/appmanifest_90.acf"; then
+	fn_print_warn_nl "ReHLDS requires the steam_legacy branch: run ./${selfname} force-update"
+	fn_script_log_warn "ReHLDS requires the steam_legacy branch: run ./${selfname} force-update"
+elif [ "$(md5sum "${serverfiles}/engine_i486.so" 2> /dev/null | awk '{print $1}')" != "a3aa351c97922f17b8290dce3f5b9bf0" ]; then
+	# shellcheck disable=SC2034 # Used by fn_fix_msg_start_nl and fn_fix_msg_end.
+	fixname="ReHLDS ${rehldsversion}"
+	fn_fix_msg_start_nl
+	fn_fetch_file "https://github.com/rehlds/ReHLDS/releases/download/${rehldsversion}/${rehldsfile}" "" "" "" "${tmpdir}" "${rehldsfile}" "nochmodx" "norun" "noforce" "87b8dd8bce18ccc2295069f7382bb4d3"
+	fn_dl_extract "${tmpdir}" "${rehldsfile}" "${tmpdir}/rehlds"
+	cp -a "${tmpdir}/rehlds/bin/linux32/." "${serverfiles}/"
+	chmod +x "${serverfiles}/hlds_linux" "${serverfiles}/hltv"
+	fn_clear_tmp
+	fn_fix_msg_end
+fi