Parcourir la source

Added steamcmd branch support

Daniel Gibbs il y a 10 ans
Parent
commit
ea5a2e3d7d

+ 3 - 0
ProjectZomboid/pzserver

@@ -42,6 +42,9 @@ githubbranch="master"
 
 # Steam
 appid="380870"
+# Allows for opting into the various Steam branches that PZ has to offer
+# Example: -beta iwillbackupmysave -betapassword iaccepttheconsequences
+branch=""
 
 # Server Details
 servicename="pz-server"

+ 2 - 2
lgsm/functions/install_server_files.sh

@@ -49,7 +49,7 @@ fn_install_server_files_steamcmd(){
 
 			if [ "${counter}" -le "4" ]; then
 				if [ "${engine}" == "goldsource" ]; then
-					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit
+					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} +quit
 					local exitcode=$?
 				else
 					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit
@@ -57,7 +57,7 @@ fn_install_server_files_steamcmd(){
 				fi
 			elif [ "${counter}" -ge "5" ]; then
 				if [ "${engine}" == "goldsource" ]; then
-					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -validate +quit
+					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" ${branch} -validate +quit
 					local exitcode=$?
 				else
 					${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit

+ 10 - 1
lgsm/functions/update_check.sh

@@ -121,7 +121,16 @@ fn_steamcmdcheck(){
 	if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then
 		rm -f "${HOME}/Steam/appcache/appinfo.vdf"
 	fi
-	availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f3)
+
+	# set branch for updateinfo
+	IFS=' ' read -a branchsplits <<< "${branch}"
+	if [ "${#branchsplits[@]}" -gt 1 ]; then
+		branchname="${branchsplits[1]}"
+	else
+		branchname="public"
+	fi
+
+	availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"${branchname}\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f3)
 	if [ -z "${availablebuild}" ]; then
 		fn_print_fail "Checking for update: SteamCMD"
 		fn_scriptlog "Failure! Checking for update: SteamCMD"