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

now uses unbuffer if available

* Now using unbuffer to stop the appearance of freezing when installing
and updating. Unbuffer is not always available so will only use it if
the command exists on the distro
Daniel Gibbs 11 лет назад
Родитель
Сommit
044d5f5aec
3 измененных файлов с 25 добавлено и 8 удалено
  1. 10 4
      functions/fn_install_serverfiles
  2. 8 2
      functions/fn_update_dl
  3. 7 2
      functions/fn_validate

+ 10 - 4
functions/fn_install_serverfiles

@@ -2,7 +2,7 @@
 # LGSM fn_install_serverfiles function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 210115
+# Version: 050515
 
 fn_steaminstallcommand(){
 counter="0"
@@ -27,10 +27,16 @@ while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_install_serverfiles.tmp)"
 			rm -rf "${rootdir}/steamcmd"
 			fn_check_steamcmd
 		fi
+
+		# Detects if unbuffer command is available.
+		if [ $(command -v unbuffer) ]; then
+			unbuffer=unbuffer
+		fi
+
 		if [ "${counter}" -le "4" ]; then
-			./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_install_serverfiles.tmp
+			${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_install_serverfiles.tmp
 		elif [ "${counter}" -ge "5" ]; then
-			./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp
+			${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp
 		fi
 	elif [ "${counter}" -ge "11" ]; then
 		fn_printfailurenl "SteamCMD did not complete the download, too many retrys"
@@ -45,7 +51,7 @@ if [ "${engine}" == "goldsource" ]; then
 	counter="0"
 	while [ "${counter}" -le "4" ]; do
 		counter=$((counter+1))
-		./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp
+		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp
 	done
 fi
 rm -f .fn_install_serverfiles.tmp

+ 8 - 2
functions/fn_update_dl

@@ -2,7 +2,7 @@
 # LGSM fn_update_dl function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 150315
+# Version: 050515
 
 # Description: Runs a server update.
 
@@ -20,7 +20,13 @@ fn_scriptlog "Updating ${servername}"
 sleep 1
 cd "${rootdir}"
 cd "steamcmd"
-./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}"
+
+# Detects if unbuffer command is available.
+if [ $(command -v unbuffer) ]; then
+	unbuffer=unbuffer
+fi
+
+${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}"
 }
 
 fn_teamspeak3_dl(){

+ 7 - 2
functions/fn_validate

@@ -2,7 +2,7 @@
 # LGSM fn_validate function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 150415
+# Version: 050515
 
 # Description: Runs a server validation.
 
@@ -22,7 +22,12 @@ fn_scriptlog "Checking server files"
 sleep 1
 cd "${rootdir}"
 cd "steamcmd"
-./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
+
+if [ $(command -v unbuffer) ]; then
+			unbuffer=unbuffer
+fi
+
+${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
 fn_scriptlog "Checking complete"
 }