From 9e7ce431b207ab921a5f154fbf5997768fe92e3a Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 15 Sep 2020 09:55:49 +0200 Subject: [PATCH] fix(squad): move systemdir to new location (#3036) --- .../config-lgsm/squadserver/_default.cfg | 2 +- lgsm/functions/core_functions.sh | 5 ++++ lgsm/functions/fix.sh | 2 ++ lgsm/functions/fix_squad.sh | 23 +++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 lgsm/functions/fix_squad.sh diff --git a/lgsm/config-default/config-lgsm/squadserver/_default.cfg b/lgsm/config-default/config-lgsm/squadserver/_default.cfg index 284f1094d..14e5862a3 100644 --- a/lgsm/config-default/config-lgsm/squadserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/squadserver/_default.cfg @@ -152,7 +152,7 @@ glibc="2.17" # Edit with care ## Game Server Directories -systemdir="${serverfiles}/Squad" +systemdir="${serverfiles}/SquadGame" executabledir="${serverfiles}" executable="./SquadGameServer.sh" servercfgdir="${systemdir}/ServerConfig" diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index 9b79fae06..081626065 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -450,6 +450,11 @@ functionfile="${FUNCNAME[0]}" fn_fetch_function } +fix_squad.sh(){ +functionfile="${FUNCNAME[0]}" +fn_fetch_function +} + fix_ss3.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index 9c773523a..9d970064b 100644 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -70,6 +70,8 @@ if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then fix_sfc.sh elif [ "${shortname}" == "sof2" ]; then fix_sof2.sh + elif [ "${shortname}" == "squad" ]; then + fix_squad.sh elif [ "${shortname}" == "ss3" ]; then fix_ss3.sh elif [ "${shortname}" == "tf2" ]; then diff --git a/lgsm/functions/fix_squad.sh b/lgsm/functions/fix_squad.sh new file mode 100644 index 000000000..199070af0 --- /dev/null +++ b/lgsm/functions/fix_squad.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# LinuxGSM fix_squad.sh function +# Author: Christian Birk +# Website: https://linuxgsm.com +# Description: Resolves various issues with Squad. + +# As the server base dir changed for the game, we need to migrate the default config from the old to the new location +oldservercfg="${serverfiles}/Squad/ServerConfig/${servercfg}" +if [ -f "${oldservercfg}" ] && [ -f "${servercfgfullpath}" ]; then + # diff old and new config - if it is different move the old config over the new one + if [ $(diff -c "${oldservercfg}" "${servercfgfullpath}" | wc -l) -gt 0 ]; then + fixname="Migrate server config to new Game folder" + fn_fix_msg_start + mv -v "${oldservercfg}" "${servercfgfullpath}" + fn_fix_msg_end + else + fixname="remove the same config from old configdir" + fn_fix_msg_start + rm -f "${oldservercfg}" + fn_fix_msg_end + + fi +fi