Explorar el Código

Merge pull request #388 from dgibbs64/steamuser-patch

Added fn_check_steamuser to check that the correct steamuser is defined
Daniel Gibbs hace 11 años
padre
commit
b09a28672c

+ 12 - 6
functions/fn_check_steamuser

@@ -1,11 +1,17 @@
 #!/bin/bash
-# LGSM fn_install_serverfiles function
+# LGSM fn_check_steamuser function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 160515
+# Version: 190515
 
-if [ -z "${steamuser}" ]; then
-        fn_printwarningnl "SteamCMD user variable is not assigned in the main script! Resorting to anonymous login"
-	steamuser="anonymous"
-	steampass=""
+if [ -z "${steamuser}" ]||[ "${steamuser}" == "username" ];; then
+		fn_printwarningnl "Steam Login not set. Using anonymous login."
+		fn_scriptlog "Steam Login not set. Using anonymous login."
+		if [ "${steamuser}" == "username" ]; then
+			echo "	* Change steamuser=\"username\" to a valid steam login."
+			fn_scriptlog "Change steamuser=\"username\" to a valid steam login."
+		fi
+		steamuser="anonymous"
+		steampass=""
+		sleep 2
 fi

+ 6 - 1
functions/fn_functions

@@ -2,7 +2,7 @@
 # LGSM fn_functions function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 110415
+# Version: 160515
 
 # Description: Defines all functions to allow download and execution of functions using fn_runfunction.
 # This function is called first before any other function. Without this file other functions would not load.
@@ -32,6 +32,11 @@ functionfile="${FUNCNAME}"
 fn_runfunction
 }
 
+fn_check_steamuser(){
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
 fn_check_systemdir(){
 functionfile="${FUNCNAME}"
 fn_runfunction

+ 2 - 7
functions/fn_install_serverfiles

@@ -2,15 +2,10 @@
 # LGSM fn_install_serverfiles function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 050515
+# Version: 190515
 
 fn_steaminstallcommand(){
-if [ -z "${steamuser}" ]; then
-	fn_printwarningnl "SteamCMD user variable is not assigned in the main script! Resorting to anonymous login"
-	steamuser="anonymous"
-	steampass=""
-fi
-
+fn_check_steamuser
 counter="0"
 while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .fn_install_serverfiles.tmp)" -ge "1" ]; do
 	counter=$((counter+1))

+ 3 - 1
functions/fn_update_check

@@ -2,7 +2,7 @@
 # LGSM fn_update_check function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 160515
+# Version: 190515
 
 # Description: Checks if a server update is available.
 
@@ -101,6 +101,8 @@ echo ""
 }
 
 fn_steamcmdcheck(){
+fn_check_steamcmd
+fn_check_steamuser
 fn_appmanifestcheck
 # Checks for server update from SteamCMD
 fn_printdots "Checking for update: SteamCMD"

+ 0 - 1
functions/fn_update_dl

@@ -14,7 +14,6 @@ fn_check_systemdir
 fn_details_config
 fn_printdots "Updating ${servername}"
 sleep 1
-fn_check_steamcmd
 fn_printoknl "Updating ${servername}"
 fn_scriptlog "Updating ${servername}"
 sleep 1

+ 4 - 2
functions/fn_validate

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