Просмотр исходного кода

Installer loops better on failure

The installer will do the following on an issue downloading the server
files in an attempt to fix the problem.
# Attempt 1-4: Standard attempt
# Attempt 5-6: Validate attempt
# Attempt 7-8: Validate, delete long name dir
# Attempt 9-10: Validate, delete long name dir, re-download SteamCMD
# Attempt 11: Failure

All goldsrc files will run a validate multiple times as well to reduce
the chance of the files not downloading due to a bug in steamCMD.

Fixed the server looping when it shouldnt
Daniel Gibbs 11 лет назад
Родитель
Сommit
d019413810
1 измененных файлов с 33 добавлено и 4 удалено
  1. 33 4
      functions/fn_steaminstall

+ 33 - 4
functions/fn_steaminstall

@@ -2,23 +2,52 @@
 # LGSM fn_steaminstall function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 060115
+# Version: 110115
 
 fn_steaminstallcommand(){
 counter="0"
 while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .fn_steaminstall.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .fn_steaminstall.tmp)" -ge "1" ]; do
 	counter=$((counter+1))
 	if [ "${counter}" -le "10" ]; then
+		# Attempt 1-4: Standard attempt
+		# Attempt 5-6: Validate attempt
+		# Attempt 7-8: Validate, delete long name dir
+		# Attempt 9-10: Validate, delete long name dir, re-download SteamCMD
+		# Attempt 11: Failure
+
 		if [ "${counter}" -ge "2" ]; then
-			fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}"
+			fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}:"
+		fi
+
+		if [ "${counter}" -ge "7" ]; then
+			echo "Removing $(find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$')"
+			find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
+		fi
+		if [ "${counter}" -ge "9" ]; then
+			rm -rf "${rootdir}/steamcmd"
+			fn_steamdl
+		fi
+		if [ "${counter}" -le "4" ]; then
+			./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_steaminstall.tmp
+		elif [ "${counter}" -ge "5" ]; then
+			./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_steaminstall.tmp
 		fi
-		./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_steaminstall.tmp
 	elif [ "${counter}" -ge "11" ]; then
 		fn_printfailurenl "SteamCMD did not complete the download, too many retrys"
 		break
 	fi
-	echo "0x402" > .fn_steaminstall.tmp
+
 done
+
+# Goldsource servers commonly fail to download all the server files required.
+# Validating a few of times may reduce the chance of this issue.
+if [ "${engine}" == "goldsource" ]; then
+	counter="0"
+	while [ "${counter}" <= "4" ]; do
+		counter=$((counter+1))
+		./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_steaminstall.tmp
+	done
+fi
 rm -f .fn_steaminstall.tmp
 }