From 67e08ba84ffa300dfa9974bd6f62f66d6d0e4d75 Mon Sep 17 00:00:00 2001
From: Daniel Gibbs <me@danielgibbs.co.uk>
Date: Fri, 18 Dec 2020 22:10:18 +0000
Subject: [PATCH 1/2] fix(update): fix broken branch selection. (#3130)

This change fixes the update command for those on public branches.
add fix to core_dl.sh
---
 lgsm/functions/core_dl.sh         | 6 +++---
 lgsm/functions/update_steamcmd.sh | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh
index 03ff54383..35b5e008b 100755
--- a/lgsm/functions/core_dl.sh
+++ b/lgsm/functions/core_dl.sh
@@ -61,7 +61,7 @@ fn_dl_steamcmd(){
 			# If using a specific branch.
 			if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then
 				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
-			elif [ -n "${branch}" ]; then
+			elif [ -n "${branch}" ]&&[ "${branch}" != "public" ]; then
 				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			else
 				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
@@ -70,7 +70,7 @@ fn_dl_steamcmd(){
 		elif [ "${shortname}" == "ac" ]||[ "${shortname}" == "jk2" ]; then
 			if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then
 				${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
-			elif [ -n "${branch}" ]; then
+			elif [ -n "${branch}" ]&&[ "${branch}" != "public" ]; then
 				${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			else
 				${unbuffer} ${steamcmdcommand} +@sSteamCmdForcePlatformType windows +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
@@ -79,7 +79,7 @@ fn_dl_steamcmd(){
 		else
 			if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then
 				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" -betapassword "${betapassword}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
-			elif [ -n "${branch}" ]; then
+			elif [ -n "${branch}" ]&&[ "${branch}" != "public" ]; then
 				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
 			else
 				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" ${validate} +quit | uniq | tee -a "${lgsmlog}" "${steamcmdlog}"
diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh
index 28496f7d7..8df7b0563 100644
--- a/lgsm/functions/update_steamcmd.sh
+++ b/lgsm/functions/update_steamcmd.sh
@@ -42,7 +42,7 @@ fn_update_steamcmd_remotebuild(){
 
 	if [ -n "${branch}" ]&&[ -n "${betapassword}" ]; then
 		remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" -beta "${branch}" -betapassword "${betapassword}" +quit | sed '1,/branches/d' | sed "1,/${branch}/d" | grep -m 1 buildid | tr -cd '[:digit:]')
-	elif [ -n "${branch}" ]; then
+	elif [ -n "${branch}" ]&&[ "${branch}" != "public" ]; then
 		remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" -beta "${branch}" +quit | sed '1,/branches/d' | sed "1,/${branch}/d" | grep -m 1 buildid | tr -cd '[:digit:]')
 	else
 		remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed '1,/branches/d' | sed "1,/${branch}/d" | grep -m 1 buildid | tr -cd '[:digit:]')

From 871af8adc99b98acfbf6f437868fe662517f4de8 Mon Sep 17 00:00:00 2001
From: Daniel Gibbs <me@danielgibbs.co.uk>
Date: Fri, 18 Dec 2020 22:14:04 +0000
Subject: [PATCH 2/2] release v20.6.2

---
 lgsm/functions/core_functions.sh | 2 +-
 tests/tests_fctrserver.sh        | 2 +-
 tests/tests_jc2server.sh         | 2 +-
 tests/tests_mcserver.sh          | 2 +-
 tests/tests_ts3server.sh         | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh
index b02084256..e4da9830f 100755
--- a/lgsm/functions/core_functions.sh
+++ b/lgsm/functions/core_functions.sh
@@ -7,7 +7,7 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-modulesversion="v20.6.1"
+modulesversion="v20.6.2"
 
 # Core
 
diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh
index 1730f7ba1..1afa2f60a 100644
--- a/tests/tests_fctrserver.sh
+++ b/tests/tests_fctrserver.sh
@@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 fi
 
-version="v20.6.1"
+version="v20.6.2"
 shortname="fctr"
 gameservername="fctrserver"
 commandname="CORE"
diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh
index 18e5f964b..aab73228d 100644
--- a/tests/tests_jc2server.sh
+++ b/tests/tests_jc2server.sh
@@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 fi
 
-version="v20.6.1"
+version="v20.6.2"
 shortname="jc2"
 gameservername="jc2server"
 commandname="CORE"
diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh
index 8aa7f73c3..edfc620b3 100644
--- a/tests/tests_mcserver.sh
+++ b/tests/tests_mcserver.sh
@@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 fi
 
-version="v20.6.1"
+version="v20.6.2"
 shortname="mc"
 gameservername="mcserver"
 commandname="CORE"
diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh
index 7c5212f40..620eb43ee 100644
--- a/tests/tests_ts3server.sh
+++ b/tests/tests_ts3server.sh
@@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 fi
 
-version="v20.6.1"
+version="v20.6.2"
 shortname="ts3"
 gameservername="ts3server"
 commandname="CORE"