فهرست منبع

fix(validate): resolve validate not functioning for non branch (#2802)

Daniel Gibbs 6 سال پیش
والد
کامیت
390fc23265
4فایلهای تغییر یافته به همراه64 افزوده شده و 17 حذف شده
  1. 13 3
      lgsm/functions/command_validate.sh
  2. 1 1
      lgsm/functions/info_messages.sh
  3. 36 11
      lgsm/functions/install_server_files.sh
  4. 14 2
      lgsm/functions/update_steamcmd.sh

+ 13 - 3
lgsm/functions/command_validate.sh

@@ -25,17 +25,27 @@ fn_validate(){
 	if [ -d "${steamcmddir}" ]; then
 		cd "${steamcmddir}" || exit
 	fi
-	# Detects if unbuffer command is available for 32 bit distributions only.
+	# Detects if unbuffer command is available, for 32 bit distributions only.
 	info_distro.sh
 	if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
 		unbuffer="stdbuf -i0 -o0 -e0"
 	fi
 
+	# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
 	if [ "${appid}" == "90" ]; then
-		${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
-	else
+		# If using a specific branch.
+		if [ -n "${branch}" ]; then
+			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
+		else
+			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
+		fi
+	# All other servers.
+	elif [ -n "${branch}" ]; then
 		${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}"
+	else
+		${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}"
 	fi
+
 	exitcode=$?
 	fn_print_dots "Validating server: SteamCMD"
 	if [ "${exitcode}" != "0" ]; then

+ 1 - 1
lgsm/functions/info_messages.sh

@@ -186,7 +186,7 @@ fn_info_message_gameserver(){
 		fi
 
 		# Branch
-		if [ "${branch}" ]; then
+		if [ -n "${branch}" ]; then
 			echo -e "${lightblue}Branch:\t${default}${branch}"
 		fi
 

+ 36 - 11
lgsm/functions/install_server_files.sh

@@ -105,19 +105,40 @@ fn_install_server_files_steamcmd(){
 			fi
 
 			if [ "${counter}" -le "4" ]; then
+				# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
 				if [ "${appid}" == "90" ]; then
-					${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit
-					local exitcode=$?
+					# If using a specific branch.
+					if [ -n "${branch}" ]; then
+							${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit
+					else
+							${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit
+					fi
+				# All other servers.
 				else
-					${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit
-					local exitcode=$?
+					if [ -n "${branch}" ]; then
+						${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update -beta "${branch}" +quit
+					else
+						${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit
+					fi
 				fi
+				local exitcode=$?
 			elif [ "${counter}" -ge "5" ]; then
-				if [ "${engine}" == "goldsrc" ]; then
-					${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit
+				# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
+				if [ "${appid}" == "90" ]; then
+					# If using a specific branch.
+					if [ -n "${branch}" ]; then
+						${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit
+					else
+						${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" validate +quit
+					fi
 					local exitcode=$?
+				# All other servers.
 				else
-					${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit
+					if [ -n "${branch}" ]; then
+						${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit
+					else
+						${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit
+					fi
 					local exitcode=$?
 				fi
 			fi
@@ -128,14 +149,18 @@ fn_install_server_files_steamcmd(){
 		fi
 	done
 
-	# GoldSrc servers commonly fail to download all the server files required.
+	# GoldSrc (appid 90) servers commonly fail to download all the server files required.
 	# Validating a few of times may reduce the chance of this issue.
-	if [ "${engine}" == "goldsrc" ]; then
-		fn_print_information_nl "GoldSrc servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue."
+	if [ "${appid}" == "90" ]; then
+  fn_print_information_nl "GoldSrc servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue."
 		counter="0"
 		while [ "${counter}" -le "4" ]; do
 			counter=$((counter+1))
-			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit
+			if [ -n "${branch}" ]; then
+				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit
+			else
+				${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" validate +quit
+			fi
 			local exitcode=$?
 		done
 	fi

+ 14 - 2
lgsm/functions/update_steamcmd.sh

@@ -18,10 +18,22 @@ fn_update_steamcmd_dl(){
 	if [ -d "${steamcmddir}" ]; then
 		cd "${steamcmddir}" || exit
 	fi
+
+	# If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands.
 	if [ "${appid}" == "90" ]; then
-		${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}"
+		# If using a specific branch.
+		if [ -n "${branch}" ]; then
+			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}"
+		else
+			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit | tee -a "${lgsmlog}"
+		fi
+	# All other servers.
 	else
-		${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}"
+		if [ -n "${branch}" ]; then
+			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}"
+		else
+			${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit | tee -a "${lgsmlog}"
+		fi
 	fi
 	fix.sh
 }