Explorar o código

Script now detects 0x402 error on SteamCMD

https://github.com/dgibbs64/linuxgameservers/issues/235
Daniel Gibbs %!s(int64=11) %!d(string=hai) anos
pai
achega
57789b0c10
Modificáronse 1 ficheiros con 26 adicións e 9 borrados
  1. 26 9
      functions/fn_steaminstall

+ 26 - 9
functions/fn_steaminstall

@@ -2,24 +2,41 @@
 # LGSM fn_steaminstall function
 # Author: Daniel Gibbs
 # Website: http://danielgibbs.co.uk
-# Version: 011214
+# Version: 241214
 
+fn_steaminstallcommand(){
+echo "0x402" > .fn_steaminstall.tmp
+while [ "$(grep -c 0x402 .fn_steaminstall.tmp)" -ge "1" ]; do
+	counter=$((counter+1))
+	if [ "${counter}" -le "10" ]; then
+		if [ "${counter}" -ge "2" ]; then
+			echo -e "\e[0;31mWarning!\e[0;39m SteamCMD did not complete the download, retrying: Attempt ${counter}"
+		fi
+		./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_steaminstall.tmp
+	elif [ "${counter}" -ge "11" ]; then
+		echo -e "\e[0;31mFailure!\e[0;39m SteamCMD did not complete the download, too many retrys"
+		break
+	fi
+done
+rm -f .fn_steaminstall.tmp
+}
+
+echo ""
 echo "Installing ${gamename} Server"
 echo "================================="
 sleep 1
 mkdir -pv "${filesdir}"
 cd "${rootdir}/steamcmd"
-STEAMEXE=steamcmd ./steamcmd.sh +login ${steamuser} "${steampass}" +force_install_dir "${filesdir}" +app_update ${appid} +quit
-if [ -z ${autoinstall} ]; then
+fn_steaminstallcommand
+if [ -z "${autoinstall}" ]; then
 	echo ""
 	echo "================================="
 	while true; do
-		read -p "Was the install successful? [y/N]" yn
+	read -p "Was the install successful? [y/N]" yn
 		case $yn in
-		[Yy]* ) break;;
-		[Nn]* ) fn_retryinstall;;
-		* ) echo "Please answer yes or no.";;
+			[Yy]* ) break;;
+			[Nn]* ) fn_retryinstall;;
+			* ) echo "Please answer yes or no.";;
 		esac
 	done
-fi
-echo ""
+fi