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

Merge branch 'dlmanage' into development

Daniel Gibbs 10 лет назад
Родитель
Сommit
a1bb5922a1
67 измененных файлов с 1469 добавлено и 1348 удалено
  1. 4 2
      7DaysToDie/sdtdserver
  2. 44 35
      JustCause2/jc2server
  3. 42 33
      UnrealTournament2004/ut2k4server
  4. 51 41
      UnrealTournament99/ut99server
  5. 8 19
      functions/check.sh
  6. 1 1
      functions/check_config.sh
  7. 86 84
      functions/check_deps.sh
  8. 2 4
      functions/check_ip.sh
  9. 2 3
      functions/check_logs.sh
  10. 1 1
      functions/check_root.sh
  11. 48 65
      functions/check_steamcmd.sh
  12. 0 23
      functions/check_steamuser.sh
  13. 2 2
      functions/check_system_dir.sh
  14. 1 1
      functions/check_tmux.sh
  15. 2 2
      functions/command_backup.sh
  16. 4 4
      functions/command_console.sh
  17. 4 6
      functions/command_debug.sh
  18. 1 1
      functions/command_details.sh
  19. 4 2
      functions/command_dev_debug.sh
  20. 1 1
      functions/command_email_test.sh
  21. 11 11
      functions/command_install.sh
  22. 79 85
      functions/command_monitor.sh
  23. 58 70
      functions/command_start.sh
  24. 194 136
      functions/command_stop.sh
  25. 5 5
      functions/command_ts3_server_pass.sh
  26. 19 6
      functions/command_update_functions.sh
  27. 5 7
      functions/command_validate.sh
  28. 202 0
      functions/core_dl.sh
  29. 140 89
      functions/core_functions.sh
  30. 16 7
      functions/core_getopt.sh
  31. 82 35
      functions/core_messages.sh
  32. 5 7
      functions/email.sh
  33. 22 3
      functions/fix.sh
  34. 3 23
      functions/fix_arma3.sh
  35. 13 31
      functions/fix_csgo.sh
  36. 5 23
      functions/fix_dst.sh
  37. 3 3
      functions/fix_glibc.sh
  38. 3 1
      functions/fix_ro.sh
  39. 13 33
      functions/fix_steamcmd.sh
  40. 7 10
      functions/fix_ut2k4.sh
  41. 3 3
      functions/fix_ut99.sh
  42. 4 4
      functions/fn_update_functions
  43. 0 0
      functions/gsquery.py
  44. 25 25
      functions/info_config.sh
  45. 8 3
      functions/info_glibc.sh
  46. 3 0
      functions/install_complete.sh
  47. 3 1
      functions/install_config.sh
  48. 0 54
      functions/install_dl_ut2k4.sh
  49. 0 54
      functions/install_dl_ut99.sh
  50. 25 30
      functions/install_gslt.sh
  51. 3 1
      functions/install_header.sh
  52. 5 9
      functions/install_logs.sh
  53. 2 0
      functions/install_retry.sh
  54. 3 1
      functions/install_server_dir.sh
  55. 40 17
      functions/install_server_files.sh
  56. 2 0
      functions/install_steamcmd.sh
  57. 5 3
      functions/install_ts3.sh
  58. 3 1
      functions/install_ts3db.sh
  59. 0 42
      functions/install_ut2k4.sh
  60. 13 4
      functions/install_ut2k4_key.sh
  61. 0 42
      functions/install_ut99.sh
  62. 11 17
      functions/logs.sh
  63. 78 82
      functions/monitor_gsquery.sh
  64. 27 27
      functions/update_check.sh
  65. 4 4
      functions/update_dl.sh
  66. 6 6
      tests/tests_jc2server.sh
  67. 3 3
      tests/tests_ts3server.sh

+ 4 - 2
7DaysToDie/sdtdserver

@@ -28,7 +28,7 @@ updateonstart="off"
 
 
 # http://7daystodie.gamepedia.com/Server
 # http://7daystodie.gamepedia.com/Server
 fn_parms(){
 fn_parms(){
-parms="-configfile=${servercfgfullpath} -dedicated"
+parms="-logfile ${gamelogdir}/output_log__`date +%Y-%m-%d__%H-%M-%S`.txt -quit -batchmode -nographics -dedicated -configfile=${servercfgfullpath}"
 }
 }
 
 
 #### Advanced Variables ####
 #### Advanced Variables ####
@@ -52,10 +52,12 @@ engine="unity3d"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 lockselfname=".${servicename}.lock"
 lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
 filesdir="${rootdir}/serverfiles"
 filesdir="${rootdir}/serverfiles"
 systemdir="${filesdir}"
 systemdir="${filesdir}"
 executabledir="${filesdir}"
 executabledir="${filesdir}"
-executable="./startserver.sh"
+executable="./7DaysToDieServer.x86"
 servercfg="${servicename}.xml"
 servercfg="${servicename}.xml"
 servercfgdir="${filesdir}"
 servercfgdir="${filesdir}"
 servercfgfullpath="${servercfgdir}/${servercfg}"
 servercfgfullpath="${servercfgdir}/${servercfg}"

+ 44 - 35
JustCause2/jc2server

@@ -4,12 +4,12 @@
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 if [ -f ".dev-debug" ]; then
 if [ -f ".dev-debug" ]; then
-	exec 5>dev-debug.log
+	run 5>dev-debug.log
 	BASH_XTRACEFD="5"
 	BASH_XTRACEFD="5"
 	set -x
 	set -x
 fi
 fi
 
 
-version="271215"
+version="160316"
 
 
 #### Variables ####
 #### Variables ####
 
 
@@ -36,7 +36,7 @@ parms=""
 # from a different repo and/or branch.
 # from a different repo and/or branch.
 githubuser="dgibbs64"
 githubuser="dgibbs64"
 githubrepo="linuxgsm"
 githubrepo="linuxgsm"
-githubbranch="master"
+githubbranch="dlmanage"
 
 
 # Steam
 # Steam
 appid="261140"
 appid="261140"
@@ -50,6 +50,8 @@ engine="avalanche"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 lockselfname=".${servicename}.lock"
 lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
 filesdir="${rootdir}/serverfiles"
 filesdir="${rootdir}/serverfiles"
 systemdir="${filesdir}"
 systemdir="${filesdir}"
 executabledir="${filesdir}"
 executabledir="${filesdir}"
@@ -76,55 +78,62 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
 ##### Script #####
 ##### Script #####
 # Do not edit
 # Do not edit
 
 
-fn_getgithubfile(){
-filename=$1
-exec=$2
-fileurl=${3:-$filename}
-filepath="${rootdir}/${filename}"
-filedir=$(dirname "${filepath}")
-# If the function file is missing, then download
-if [ ! -f "${filepath}" ]; then
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
 	if [ ! -d "${filedir}" ]; then
 	if [ ! -d "${filedir}" ]; then
-		mkdir "${filedir}"
+		mkdir -p "${filedir}"
 	fi
 	fi
-	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
 	echo -e "    fetching ${filename}...\c"
 	echo -e "    fetching ${filename}...\c"
-	if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
-		:
-	else	
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl $(echo $PATH | sed "s/\([:]\|\$\)/\/curl /g")"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi		
+	else
 		echo -e "\e[0;31mFAIL\e[0m\n"
 		echo -e "\e[0;31mFAIL\e[0m\n"
 		echo "Curl is not installed!"
 		echo "Curl is not installed!"
 		echo -e ""
 		echo -e ""
-		exit
-	fi
-	curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
-	if [ $? -ne 0 ]; then
-		echo -e "\e[0;31mFAIL\e[0m\n"
-		echo "${curl}"
-		echo -e "${githuburl}\n"
-		exit
-	else
-		echo -e "\e[0;32mOK\e[0m"
-	fi	
-	if [ "${exec}" ]; then
-		chmod +x "${filepath}"
+		exit 1
 	fi
 	fi
+	chmod +x "${filedir}/${filename}"
 fi
 fi
-if [ "${exec}" ]; then
-	source "${filepath}"
-fi
+source "${filedir}/${filename}"
 }
 }
 
 
-fn_runfunction(){
-	fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
 }
 }
 
 
 core_functions.sh(){
 core_functions.sh(){
 # Functions are defined in core_functions.sh.
 # Functions are defined in core_functions.sh.
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
 }
 }
 
 
+core_dl.sh
 core_functions.sh
 core_functions.sh
 
 
 getopt=$1
 getopt=$1

+ 42 - 33
UnrealTournament2004/ut2k4server

@@ -35,6 +35,8 @@ engine="unreal2"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 lockselfname=".${servicename}.lock"
 lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
 filesdir="${rootdir}/serverfiles"
 filesdir="${rootdir}/serverfiles"
 systemdir="${filesdir}/System"
 systemdir="${filesdir}/System"
 executabledir="${systemdir}"
 executabledir="${systemdir}"
@@ -71,56 +73,63 @@ githubbranch="master"
 ##### Script #####
 ##### Script #####
 # Do not edit
 # Do not edit
 
 
-fn_getgithubfile(){
-filename=$1
-exec=$2
-fileurl=${3:-$filename}
-filepath="${rootdir}/${filename}"
-filedir=$(dirname "${filepath}")
-# If the function file is missing, then download
-if [ ! -f "${filepath}" ]; then
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
 	if [ ! -d "${filedir}" ]; then
 	if [ ! -d "${filedir}" ]; then
-		mkdir "${filedir}"
+		mkdir -p "${filedir}"
 	fi
 	fi
-	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
 	echo -e "    fetching ${filename}...\c"
 	echo -e "    fetching ${filename}...\c"
-	if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
-		:
-	else	
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl $(echo $PATH | sed "s/\([:]\|\$\)/\/curl /g")"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi		
+	else
 		echo -e "\e[0;31mFAIL\e[0m\n"
 		echo -e "\e[0;31mFAIL\e[0m\n"
 		echo "Curl is not installed!"
 		echo "Curl is not installed!"
 		echo -e ""
 		echo -e ""
-		exit
-	fi
-	curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
-	if [ $? -ne 0 ]; then
-		echo -e "\e[0;31mFAIL\e[0m\n"
-		echo "${curl}"
-		echo -e "${githuburl}\n"
-		exit
-	else
-		echo -e "\e[0;32mOK\e[0m"
-	fi	
-	if [ "${exec}" ]; then
-		chmod +x "${filepath}"
+		exit 1
 	fi
 	fi
+	chmod +x "${filedir}/${filename}"
 fi
 fi
-if [ "${exec}" ]; then
-	source "${filepath}"
-fi
+source "${filedir}/${filename}"
 }
 }
 
 
-fn_runfunction(){
-	fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
 }
 }
 
 
 core_functions.sh(){
 core_functions.sh(){
 # Functions are defined in core_functions.sh.
 # Functions are defined in core_functions.sh.
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
 }
 }
 
 
+core_dl.sh
 core_functions.sh
 core_functions.sh
 
 
 getopt=$1
 getopt=$1
-core_getopt.sh
+core_getopt.sh

+ 51 - 41
UnrealTournament99/ut99server

@@ -9,7 +9,7 @@ if [ -f ".dev-debug" ]; then
 	set -x
 	set -x
 fi
 fi
 
 
-version="121215"
+version="260216"
 
 
 #### Variables ####
 #### Variables ####
 
 
@@ -28,6 +28,13 @@ parms="server ${defaultmap}.unr ini=${servercfgfullpath}"
 
 
 #### Advanced Variables ####
 #### Advanced Variables ####
 
 
+# Github Branch Select
+# Allows for the use of different function files
+# from a different repo and/or branch.
+githubuser="dgibbs64"
+githubrepo="linuxgsm"
+githubbranch="master"
+
 # Server Details
 # Server Details
 servicename="ut99-server"
 servicename="ut99-server"
 gamename="Unreal Tournament 99"
 gamename="Unreal Tournament 99"
@@ -37,6 +44,8 @@ engine="unreal"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 lockselfname=".${servicename}.lock"
 lockselfname=".${servicename}.lock"
+lgsmdir="${rootdir}/lgsm"
+functionsdir="${lgsmdir}/functions"
 filesdir="${rootdir}/serverfiles"
 filesdir="${rootdir}/serverfiles"
 systemdir="${filesdir}/System"
 systemdir="${filesdir}/System"
 executabledir="${systemdir}"
 executabledir="${systemdir}"
@@ -50,6 +59,7 @@ backupdir="${rootdir}/backups"
 
 
 # Logging
 # Logging
 logdays="7"
 logdays="7"
+gamelogdir="${systemdir}/Logs/"
 scriptlogdir="${rootdir}/log/script"
 scriptlogdir="${rootdir}/log/script"
 consolelogdir="${rootdir}/log/console"
 consolelogdir="${rootdir}/log/console"
 
 
@@ -60,66 +70,66 @@ emaillog="${scriptlogdir}/${servicename}-email.log"
 scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
 scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
 consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
 consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
 
 
-# Github Branch Select
-# Allows for the use of different function files
-# from a different repo and/or branch.
-githubuser="dgibbs64"
-githubrepo="linuxgsm"
-githubbranch="master"
-
 ##### Script #####
 ##### Script #####
 # Do not edit
 # Do not edit
 
 
-fn_getgithubfile(){
-filename=$1
-exec=$2
-fileurl=${3:-$filename}
-filepath="${rootdir}/${filename}"
-filedir=$(dirname "${filepath}")
-# If the function file is missing, then download
-if [ ! -f "${filepath}" ]; then
+# Fetches core_dl for file downloads
+fn_fetch_core_dl(){
+github_file_url_dir="functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
 	if [ ! -d "${filedir}" ]; then
 	if [ ! -d "${filedir}" ]; then
-		mkdir "${filedir}"
+		mkdir -p "${filedir}"
 	fi
 	fi
-	githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
 	echo -e "    fetching ${filename}...\c"
 	echo -e "    fetching ${filename}...\c"
-	if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
-		:
-	else	
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl $(echo $PATH | sed "s/\([:]\|\$\)/\/curl /g")"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi		
+	else
 		echo -e "\e[0;31mFAIL\e[0m\n"
 		echo -e "\e[0;31mFAIL\e[0m\n"
 		echo "Curl is not installed!"
 		echo "Curl is not installed!"
 		echo -e ""
 		echo -e ""
-		exit
-	fi
-	curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
-	if [ $? -ne 0 ]; then
-		echo -e "\e[0;31mFAIL\e[0m\n"
-		echo "${curl}"
-		echo -e "${githuburl}\n"
-		exit
-	else
-		echo -e "\e[0;32mOK\e[0m"
-	fi	
-	if [ "${exec}" ]; then
-		chmod +x "${filepath}"
+		exit 1
 	fi
 	fi
+	chmod +x "${filedir}/${filename}"
 fi
 fi
-if [ "${exec}" ]; then
-	source "${filepath}"
-fi
+source "${filedir}/${filename}"
 }
 }
 
 
-fn_runfunction(){
-	fn_getgithubfile "functions/${functionfile}" 1
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
 }
 }
 
 
 core_functions.sh(){
 core_functions.sh(){
 # Functions are defined in core_functions.sh.
 # Functions are defined in core_functions.sh.
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
 }
 }
 
 
+core_dl.sh
 core_functions.sh
 core_functions.sh
 
 
 getopt=$1
 getopt=$1
-core_getopt.sh
+core_getopt.sh

+ 8 - 19
functions/check.sh

@@ -2,30 +2,21 @@
 # LGSM fn_check function
 # LGSM fn_check function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="190216"
+lgsm_version="060316"
 
 
 # Description: Overall function for managing checks.
 # Description: Overall function for managing checks.
 # Runs checks that will either halt on or fix an issue.
 # Runs checks that will either halt on or fix an issue.
 
 
-array_contains () {
-	local seeking=$1; shift
-	local in=1
-	for element; do
-		if [ ${element} == ${seeking} ]; then
-			in=0
-			break
-		fi
-	done
-	return $in
-}
+# Every command that requires checks just references check.sh
+# check.sh selects which checks to run by using arrays
 
 
 check_root.sh
 check_root.sh
 
 
-if [ "${function_selfname}" != "command_install.sh" ] && [ "${function_selfname}" != "update_functions.sh" ]; then
-	check_systemdir.sh
+if [ "${function_selfname}" != "command_install.sh" ] && [ "${function_selfname}" != "command_update_functions.sh" ]; then
+	check_system_dir.sh
 fi
 fi
 
 
-local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_ut99_maps.sh command_monitor.sh command_start.sh command_stop.sh update_check.sh command_validate.sh update_functions.sh command_email_test.sh )
+local allowed_commands_array=( command_backup.sh command_console.sh command_debug.sh command_details.sh command_unreal2_maps.sh command_ut99_maps.sh command_monitor.sh command_start.sh command_stop.sh update_check.sh command_validate.sh command_update_functions.sh command_email_test.sh )
 for allowed_command in "${allowed_commands_array[@]}"
 for allowed_command in "${allowed_commands_array[@]}"
 do
 do
 	if [ "${allowed_command}" == "${function_selfname}" ]; then
 	if [ "${allowed_command}" == "${function_selfname}" ]; then
@@ -49,13 +40,11 @@ do
 	fi
 	fi
 done
 done
 
 
-local allowed_commands_array=( update_check.sh command_validate.sh )
+local allowed_commands_array=( update_check.sh command_debug.sh command_start.sh command_validate.sh )
 for allowed_command in "${allowed_commands_array[@]}"
 for allowed_command in "${allowed_commands_array[@]}"
 do
 do
 	if [ "${allowed_command}" == "${function_selfname}" ]; then
 	if [ "${allowed_command}" == "${function_selfname}" ]; then
-		if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Teamspeak 3" ]; then
-			: # These servers do not require SteamCMD. Check is skipped.
-		else
+		if [ -n "${appid}" ]; then
 			check_steamcmd.sh
 			check_steamcmd.sh
 		fi
 		fi
 	fi
 	fi

+ 1 - 1
functions/check_config.sh

@@ -8,7 +8,7 @@ lgsm_version="060116"
 
 
 if [ ! -e "${servercfgfullpath}" ]; then
 if [ ! -e "${servercfgfullpath}" ]; then
 	if [ "${gamename}" != "Hurtworld" ]; then
 	if [ "${gamename}" != "Hurtworld" ]; then
-		fn_printwarnnl "Config file missing!"
+		fn_print_warn_nl "Config file missing!"
 		echo "${servercfgfullpath}"
 		echo "${servercfgfullpath}"
 		fn_scriptlog "Configuration file missing!"
 		fn_scriptlog "Configuration file missing!"
 		fn_scriptlog "${servercfgfullpath}"
 		fn_scriptlog "${servercfgfullpath}"

+ 86 - 84
functions/check_deps.sh

@@ -2,101 +2,103 @@
 # LGSM check_deps.sh function
 # LGSM check_deps.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="190216"
+lgsm_version="060316"
 
 
 # Description: Checks that the requires dependencies are installed for LGSM.
 # Description: Checks that the requires dependencies are installed for LGSM.
 
 
 
 
 fn_deps_detector(){
 fn_deps_detector(){
-# Checks if dependency is missing
-if [ -n "$(command -v dpkg-query)" ]; then
-	dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null| grep -q -P '^install ok installed$'
-	depstatus=$?
-elif [ -n "$(command -v yum)" ]; then
-	yum -q list installed ${deptocheck} > /dev/null 2>&1
-	depstatus=$?
-fi	
-if [ "${depstatus}" == "0" ]; then
-	missingdep=0
-	if [ "${function_selfname}" == "command_install.sh" ]; then
-		echo -e "\e[0;32m${deptocheck}\e[0m"
-		sleep 0.5
-	fi
-else
-	# if missing dependency is found
-	missingdep=1
-	if [ "${function_selfname}" == "command_install.sh" ]; then
-		echo -e "\e[0;31m${deptocheck}\e[0m"
-		sleep 0.5
+	# Checks if dependency is missing
+	if [ -n "$(command -v dpkg-query)" ]; then
+		dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null| grep -q -P '^install ok installed$'
+		depstatus=$?
+	elif [ -n "$(command -v yum)" ]; then
+		yum -q list installed ${deptocheck} > /dev/null 2>&1
+		depstatus=$?
 	fi	
 	fi	
-fi
+	if [ "${depstatus}" == "0" ]; then
+		missingdep=0
+		if [ "${function_selfname}" == "command_install.sh" ]; then
+			echo -e "\e[0;32m${deptocheck}\e[0m"
+			sleep 0.5
+		fi
+	else
+		# if missing dependency is found
+		missingdep=1
+		if [ "${function_selfname}" == "command_install.sh" ]; then
+			echo -e "\e[0;31m${deptocheck}\e[0m"
+			sleep 0.5
+		fi	
+	fi
 
 
-# Missing dependencies are added to array_deps_missing
-if [ "${missingdep}" == "1" ]; then
-	array_deps_missing+=("${deptocheck}")
-fi
+	# Missing dependencies are added to array_deps_missing
+	if [ "${missingdep}" == "1" ]; then
+		array_deps_missing+=("${deptocheck}")
+	fi
 }
 }
 
 
 fn_deps_email(){
 fn_deps_email(){
-# Adds postfix to required dependencies if email notification is enabled
-if [ "${emailnotification}" == "on" ]; then
-	if [ -f /usr/bin/mailx ]; then
-		if [ -d /etc/exim4 ]; then
-			array_deps_required+=( exim4 )
-		elif [ -d /etc/sendmail ]; then
-			array_deps_required+=( sendmail )
-		elif [ -n "$(command -v dpkg-query)" ]; then
-			array_deps_required+=( mailutils postfix )
-		elif [ -n "$(command -v yum)" ]; then
-			array_deps_required+=( mailx postfix )
-		fi	
-	else 
-		if [ -n "$(command -v dpkg-query)" ]; then
-			array_deps_required+=( mailutils postfix )
-		elif [ -n "$(command -v yum)" ]; then
-			array_deps_required+=( mailx postfix )
+	# Adds postfix to required dependencies if email notification is enabled
+	if [ "${emailnotification}" == "on" ]; then
+		if [ -f /usr/bin/mailx ]; then
+			if [ -d /etc/exim4 ]; then
+				array_deps_required+=( exim4 )
+			elif [ -d /etc/sendmail ]; then
+				array_deps_required+=( sendmail )
+			elif [ -n "$(command -v dpkg-query)" ]; then
+				array_deps_required+=( mailutils postfix )
+			elif [ -n "$(command -v yum)" ]; then
+				array_deps_required+=( mailx postfix )
+			fi	
+		else 
+			if [ -n "$(command -v dpkg-query)" ]; then
+				array_deps_required+=( mailutils postfix )
+			elif [ -n "$(command -v yum)" ]; then
+				array_deps_required+=( mailx postfix )
+			fi
 		fi
 		fi
 	fi
 	fi
-fi
 }
 }
 
 
 fn_found_missing_deps(){
 fn_found_missing_deps(){
-if [ "${#array_deps_missing[@]}" != "0" ]; then
-	fn_printdots "Checking dependencies"
-	sleep 2
-	fn_printwarn "Checking dependencies: Dependency missing: \e[0;31m${array_deps_missing[@]}\e[0m"
-	sleep 1
-	echo -e ""
-	sudo -n true > /dev/null 2>&1
-	if [ $? -eq 0 ]; then
-		fn_printinfonl "Attempting to install missing dependencies automatically"
-		echo -en ".\r"
+	if [ "${#array_deps_missing[@]}" != "0" ]; then
+		fn_print_dots "Checking dependencies"
+		sleep 2
+		fn_print_warn "Checking dependencies: missing: \e[0;31m${array_deps_missing[@]}\e[0m"
+		fn_scriptlog "Checking dependencies: missing: \e[0;31m${array_deps_missing[@]}\e[0m"
 		sleep 1
 		sleep 1
-		echo -en "..\r"
-		sleep 1
-		echo -en "...\r"
-		sleep 1
-		echo -en "   \r"	
-		if [ -n "$(command -v dpkg-query)" ]; then
-			echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
-		elif [ -n "$(command -v yum)" ]; then
-			echo "yum install ${array_deps_missing[@]}"
-		fi	
-	else
-		echo ""
-		fn_printinfomationnl "$(whoami) does not have sudo access. manually install dependencies"
-		echo ""
-		if [ -n "$(command -v dpkg-query)" ]; then
-			echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
-		elif [ -n "$(command -v yum)" ]; then
-			echo "yum install ${array_deps_missing[@]}"
-		fi	
-		echo ""
-	fi
-	if [ "${function_selfname}" == "command_install.sh" ]; then
-		sleep 5
-	fi
-fi	
+		echo -e ""
+		sudo -n true > /dev/null 2>&1
+		if [ $? -eq 0 ]; then
+			fn_print_info_nl "Attempting to install missing dependencies automatically"
+			echo -en ".\r"
+			sleep 1
+			echo -en "..\r"
+			sleep 1
+			echo -en "...\r"
+			sleep 1
+			echo -en "   \r"	
+			if [ -n "$(command -v dpkg-query)" ]; then
+				echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
+			elif [ -n "$(command -v yum)" ]; then
+				echo "yum install ${array_deps_missing[@]}"
+			fi	
+		else
+			echo ""
+			fn_print_infomation_nl "$(whoami) does not have sudo access. manually install dependencies"
+			fn_scriptlog "$(whoami) does not have sudo access. manually install dependencies"
+			echo ""
+			if [ -n "$(command -v dpkg-query)" ]; then
+				echo "sudo dpkg --add-architecture i386; sudo apt-get install ${array_deps_missing[@]}"
+			elif [ -n "$(command -v yum)" ]; then
+				echo "yum install ${array_deps_missing[@]}"
+			fi	
+			echo ""
+		fi
+		if [ "${function_selfname}" == "command_install.sh" ]; then
+			sleep 5
+		fi
+	fi	
 }
 }
 
 
 fn_check_loop(){
 fn_check_loop(){
@@ -145,7 +147,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
 	if [ "${engine}" ==  "spark" ]; then
 	if [ "${engine}" ==  "spark" ]; then
 		array_deps_required+=( speex:i386 libtbb2 )
 		array_deps_required+=( speex:i386 libtbb2 )
 	# 7 Days to Die	
 	# 7 Days to Die	
-	elif [ "${executable}" ==  "./7DaysToDie.sh" ]; then
+	elif [ "${gamename}" ==  "7 Days To Die" ]; then
 		array_deps_required+=( telnet expect )
 		array_deps_required+=( telnet expect )
 	# No More Room in Hell	
 	# No More Room in Hell	
 	elif [ "${gamename}" == "No More Room in Hell" ]; then
 	elif [ "${gamename}" == "No More Room in Hell" ]; then
@@ -159,7 +161,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
 	elif [ "${executable}" ==  "./ucc-bin" ]; then
 	elif [ "${executable}" ==  "./ucc-bin" ]; then
 		#UT2K4
 		#UT2K4
 		if [ -f "${executabledir}/ut2004-bin" ]; then
 		if [ -f "${executabledir}/ut2004-bin" ]; then
-			array_deps_required+=( libsdl1.2debian libstdc++5:i386 bzip2 unzip )
+			array_deps_required+=( libsdl1.2debian libstdc++5:i386 bzip2 )
 		#UT99
 		#UT99
 		else
 		else
 			array_deps_required+=( libsdl1.2debian bzip2 )
 			array_deps_required+=( libsdl1.2debian bzip2 )
@@ -191,7 +193,7 @@ elif [ -n "$(command -v yum)" ]; then
 	if [ "${engine}" ==  "spark" ]; then
 	if [ "${engine}" ==  "spark" ]; then
 		array_deps_required+=( speex.i686 tbb.i686 )
 		array_deps_required+=( speex.i686 tbb.i686 )
 	# 7 Days to Die	
 	# 7 Days to Die	
-	elif [ "${executable}" ==  "./7DaysToDie.sh" ]; then
+	elif [ "${gamename}" ==  "7 Days To Die" ]; then
 		array_deps_required+=( telnet expect )
 		array_deps_required+=( telnet expect )
 	# No More Room in Hell	
 	# No More Room in Hell	
 	elif [ "${gamename}" == "No More Room in Hell" ]; then
 	elif [ "${gamename}" == "No More Room in Hell" ]; then
@@ -205,7 +207,7 @@ elif [ -n "$(command -v yum)" ]; then
 	elif [ "${executable}" ==  "./ucc-bin" ]; then
 	elif [ "${executable}" ==  "./ucc-bin" ]; then
 		#UT2K4
 		#UT2K4
 		if [ -f "${executabledir}/ut2004-bin" ]; then
 		if [ -f "${executabledir}/ut2004-bin" ]; then
-			array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 unzip )
+			array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 )
 		#UT99
 		#UT99
 		else
 		else
 			array_deps_required+=( SDL.i686 bzip2 )
 			array_deps_required+=( SDL.i686 bzip2 )
@@ -213,4 +215,4 @@ elif [ -n "$(command -v yum)" ]; then
 	fi
 	fi
 	fn_deps_email
 	fn_deps_email
 	fn_check_loop
 	fn_check_loop
-fi
+fi

+ 2 - 4
functions/check_ip.sh

@@ -7,9 +7,7 @@ lgsm_version="271215"
 # Description: Automatically identifies the server interface IP.
 # Description: Automatically identifies the server interface IP.
 # If multiple interfaces are detected the user will need to manualy set using ip="0.0.0.0".
 # If multiple interfaces are detected the user will need to manualy set using ip="0.0.0.0".
 
 
-if [ "${gamename}" == "Teamspeak 3" ]; then
-	:
-else
+if [ "${gamename}" != "Teamspeak 3" ]; then
 	if [ ! -f "/bin/ip" ]; then
 	if [ ! -f "/bin/ip" ]; then
 		ipcommand="/sbin/ip"
 		ipcommand="/sbin/ip"
 	else
 	else
@@ -20,7 +18,7 @@ else
 
 
 	if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
 	if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
 		if [ "${getipwc}" -ge "2" ]; then
 		if [ "${getipwc}" -ge "2" ]; then
-			fn_printwarn "Multiple active network interfaces found.\n\n"
+			fn_print_warn "Multiple active network interfaces found.\n\n"
 			echo -en "Manually specify the IP you want to use within the ${selfname} script.\n"
 			echo -en "Manually specify the IP you want to use within the ${selfname} script.\n"
 			echo -en "Set ip=\"0.0.0.0\" to one of the following:\n"
 			echo -en "Set ip=\"0.0.0.0\" to one of the following:\n"
 			echo -en "${getip}\n"
 			echo -en "${getip}\n"

+ 2 - 3
functions/check_logs.sh

@@ -8,10 +8,9 @@ lgsm_version="271215"
 
 
 # Create dir's for the script and console logs
 # Create dir's for the script and console logs
 if [ ! -d "${scriptlogdir}" ]; then
 if [ ! -d "${scriptlogdir}" ]; then
-	fn_printdots "Checking for log files"
+	fn_print_dots "Checking for log files"
 	sleep 1
 	sleep 1
-	fn_printinfo "Checking for log files: Creating log files"
-	echo -en "\n"
+	fn_print_info_nl "Checking for log files: Creating log files"
 	checklogs=1
 	checklogs=1
 	install_logs.sh
 	install_logs.sh
 fi
 fi

+ 1 - 1
functions/check_root.sh

@@ -5,7 +5,7 @@
 lgsm_version="271215"
 lgsm_version="271215"
 
 
 if [ $(whoami) = "root" ]; then
 if [ $(whoami) = "root" ]; then
-	fn_printfailnl "Do NOT run this script as root!"
+	fn_print_fail_nl "Do NOT run this script as root!"
 	if [ -d "${scriptlogdir}" ]; then
 	if [ -d "${scriptlogdir}" ]; then
 		fn_scriptlog "${selfname} attempted to run as root."
 		fn_scriptlog "${selfname} attempted to run as root."
 	fi	
 	fi	

+ 48 - 65
functions/check_steamcmd.sh

@@ -8,83 +8,66 @@ lgsm_version="160316"
 
 
 
 
 fn_install_steamcmd(){
 fn_install_steamcmd(){
-echo "Installing steamCMD"
-if [ ! -d "${steamcmddir}" ]; then
-	mkdir -v "${steamcmddir}"
-fi
-curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1)
-exitcode=$?
-echo -e "downloading steamcmd_linux.tar.gz...\c"
-if [ $exitcode -eq 0 ]; then
-	fn_printokeol
-else
-	fn_printfaileol
-	echo "${curl}"
-	echo -e "${githuburl}\n"
-	exit $exitcode
-fi
-tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}"
-rm -v "${steamcmddir}/steamcmd_linux.tar.gz"
-chmod +x "${steamcmddir}/steamcmd.sh"
-echo ""
+	if [ ! -d "${steamcmddir}" ]; then
+		mkdir -v "${steamcmddir}"
+	fi
+	fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${lgsmdir}/tmp" "steamcmd_linux.tar.gz"
+	fn_dl_extract "${lgsmdir}/tmp" "steamcmd_linux.tar.gz" "${steamcmddir}"
+	chmod +x "${steamcmddir}/steamcmd.sh"
 }
 }
 
 
 
 
 fn_check_steamcmd_user(){
 fn_check_steamcmd_user(){
-# Checks steamuser is setup. 
-if [ "${steamuser}" == "username" ]; then
-	fn_printfailnl "Steam login not set. Update steamuser."	
-	echo "	* Change steamuser=\"username\" to a valid steam login."
-	if [ -d "${scriptlogdir}" ]; then
-		fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login."
-		exit 1
-	fi
-fi
-# Anonymous user is set if steamuser is missing
-if [ -z "${steamuser}" ]; then
-	fn_printwarnnl "Steam login not set. Using anonymous login."
-	if [ -d "${scriptlogdir}" ]; then
-		fn_scriptlog "Steam login not set. Using anonymous login."
+	# Checks steamuser is setup. 
+	if [ "${steamuser}" == "username" ]; then
+		fn_print_fail_nl "Steam login not set. Update steamuser."	
+		echo "	* Change steamuser=\"username\" to a valid steam login."
+		if [ -d "${scriptlogdir}" ]; then
+			fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login."
+			exit 1
+		fi
 	fi
 	fi
-	steamuser="anonymous"
-	steampass=""
-	sleep 2
-fi	
+	# Anonymous user is set if steamuser is missing
+	if [ -z "${steamuser}" ]; then
+		fn_print_warn_nl "Steam login not set. Using anonymous login."
+		if [ -d "${scriptlogdir}" ]; then
+			fn_scriptlog "Steam login not set. Using anonymous login."
+		fi
+		steamuser="anonymous"
+		steampass=""
+		sleep 2
+	fi	
 }
 }
 
 
 fn_check_steamcmd_sh(){
 fn_check_steamcmd_sh(){
-# Checks if SteamCMD exists when starting or updating a server.
-# Installs if missing.
-steamcmddir="${rootdir}/steamcmd"
-if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
-	if [ "${function_selfname}" == "command_install.sh" ]; then
-		fn_install_steamcmd
-	else	
-		fn_printwarnnl "SteamCMD is missing"
-		fn_scriptlog "SteamCMD is missing"
-		sleep 1
-		fn_install_steamcmd
+	# Checks if SteamCMD exists when starting or updating a server.
+	# Installs if missing.
+	steamcmddir="${rootdir}/steamcmd"
+	if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then
+		if [ "${function_selfname}" == "command_install.sh" ]; then
+			fn_install_steamcmd
+		else	
+			fn_print_warn_nl "SteamCMD is missing"
+			fn_scriptlog "SteamCMD is missing"
+			sleep 1
+			fn_install_steamcmd
+		fi
+	elif [ "${function_selfname}" == "command_install.sh" ]; then
+		fn_print_infomation "SteamCMD is already installed..."
+		fn_print_ok_eol_nl
 	fi
 	fi
-elif [ "${function_selfname}" == "command_install.sh" ]; then
-	fn_printinfomation "SteamCMD is already installed..."
-	fn_printokeol	
-fi
 }
 }
 
 
 fn_check_steamcmd_guard(){
 fn_check_steamcmd_guard(){
-if [ "${function_selfname}" == "command_update.sh" ]||[ "${function_selfname}" == "command_validate.sh" ]; then
-	# Checks that steamcmd is working correctly and will prompt Steam Guard if required.
-	"${steamcmddir}"/steamcmd.sh +login "${steamuser}" "${steampass}" +quit
-	if [ $? -ne 0 ]; then
-		fn_printfailurenl "Error running SteamCMD"	
+	if [ "${function_selfname}" == "command_update.sh" ]||[ "${function_selfname}" == "command_validate.sh" ]; then
+		# Checks that steamcmd is working correctly and will prompt Steam Guard if required.
+		"${steamcmddir}"/steamcmd.sh +login "${steamuser}" "${steampass}" +quit
+		if [ $? -ne 0 ]; then
+			fn_print_failure_nl "Error running SteamCMD"	
+		fi		
 	fi		
 	fi		
-fi		
 }
 }
 
 
-if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]||[ "${gamename}" == "Mumble" ]||[ "${gamename}" == "Teamspeak 3" ]; then
-	: # These servers do not require SteamCMD. Check is skipped.
-else
-	fn_check_steamcmd_user
-	fn_check_steamcmd_sh
-	fn_check_steamcmd_guard
-fi
+fn_check_steamcmd_user
+fn_check_steamcmd_sh
+fn_check_steamcmd_guard

+ 0 - 23
functions/check_steamuser.sh

@@ -1,23 +0,0 @@
-#!/bin/bash
-# LGSM check_steamuser.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-if [ "${steamuser}" == "username" ]; then
-	fn_printfailnl "Steam login not set. Update steamuser."	
-	echo "	* Change steamuser=\"username\" to a valid steam login."
-	if [ -d ${scriptlogdir} ]; then
-		fn_scriptlog "edit ${selfname}. change steamuser=\"username\" to a valid steam login."
-		exit 1
-	fi
-fi
-if [ -z "${steamuser}" ]; then
-	fn_printwarnnl "Steam login not set. Using anonymous login."
-	if [ -d "${scriptlogdir}" ]; then
-		fn_scriptlog "Steam login not set. Using anonymous login."
-	fi
-	steamuser="anonymous"
-	steampass=""
-	sleep 2
-fi

+ 2 - 2
functions/check_systemdir.sh → functions/check_system_dir.sh

@@ -1,11 +1,11 @@
 #!/bin/bash
 #!/bin/bash
-# LGSM check_systemdir.sh function
+# LGSM check_system_dir.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
 if [ ! -d "${systemdir}" ]; then
 if [ ! -d "${systemdir}" ]; then
-	fn_printfailnl "Cannot access ${systemdir}: No such directory"
+	fn_print_fail_nl "Cannot access ${systemdir}: No such directory"
 	if [ -d "${scriptlogdir}" ]; then
 	if [ -d "${scriptlogdir}" ]; then
 		fn_scriptlog "Cannot access ${systemdir}: No such directory."
 		fn_scriptlog "Cannot access ${systemdir}: No such directory."
 	fi		
 	fi		

+ 1 - 1
functions/check_tmux.sh

@@ -9,7 +9,7 @@ lgsm_version="271215"
 if [ "$(command -v tmux)" ]||[ "$(which tmux >/dev/null 2>&1)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
 if [ "$(command -v tmux)" ]||[ "$(which tmux >/dev/null 2>&1)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
 	:
 	:
 else
 else
-	fn_printfailnl "Tmux not installed"
+	fn_print_fail_nl "Tmux not installed"
 	sleep 1
 	sleep 1
 	fn_scriptlog "Tmux is not installed"
 	fn_scriptlog "Tmux is not installed"
 	echo "	* Tmux is required to run this server."
 	echo "	* Tmux is required to run this server."

+ 2 - 2
functions/command_backup.sh

@@ -30,7 +30,7 @@ done
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
 if [ "${tmuxwc}" -eq 1 ]; then
 if [ "${tmuxwc}" -eq 1 ]; then
 	echo ""
 	echo ""
-	fn_printwarningnl "${servicename} is currently running."
+	fn_print_warning_nl "${servicename} is currently running."
 	sleep 1
 	sleep 1
 	while true; do
 	while true; do
 		read -p "Stop ${servicename} while running the backup? [y/N]" yn
 		read -p "Stop ${servicename} while running the backup? [y/N]" yn
@@ -59,6 +59,6 @@ echo "Backup created: ${backupdir}/${backupname}.tar.gz"
 fn_scriptlog "Created: ${backupdir}/${backupname}.tar.gz"
 fn_scriptlog "Created: ${backupdir}/${backupname}.tar.gz"
 sleep 1
 sleep 1
 echo ""
 echo ""
-fn_printcompletenl "Complete."
+fn_print_complete_nl "Complete."
 fn_scriptlog "Complete"
 fn_scriptlog "Complete"
 echo ""
 echo ""

+ 4 - 4
functions/command_console.sh

@@ -15,7 +15,7 @@ echo "${gamename} Console"
 echo "============================"
 echo "============================"
 echo ""
 echo ""
 echo "Press \"CTRL+b d\" to exit console."
 echo "Press \"CTRL+b d\" to exit console."
-fn_printwarningnl "Do NOT press CTRL+c to exit."
+fn_print_warning_nl "Do NOT press CTRL+c to exit."
 echo ""
 echo ""
 while true; do
 while true; do
 	read -e -i "y" -p "Continue? [y/N]" yn
 	read -e -i "y" -p "Continue? [y/N]" yn
@@ -25,16 +25,16 @@ while true; do
 	* ) echo "Please answer yes or no.";;
 	* ) echo "Please answer yes or no.";;
 esac
 esac
 done
 done
-fn_printdots "Starting"
+fn_print_dots "Starting"
 sleep 1
 sleep 1
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
 if [ "${tmuxwc}" -eq 1 ]; then
 if [ "${tmuxwc}" -eq 1 ]; then
-	fn_printoknl "Starting"
+	fn_print_ok_nl "Starting"
 	fn_scriptlog "accessed"
 	fn_scriptlog "accessed"
 	sleep 1
 	sleep 1
 	tmux attach-session -t ${servicename}
 	tmux attach-session -t ${servicename}
 else
 else
-	fn_printfailnl "Server not running"
+	fn_print_fail_nl "Server not running"
 	fn_scriptlog "Failed to access: Server not running"
 	fn_scriptlog "Failed to access: Server not running"
 	sleep 1
 	sleep 1
 	while true; do
 	while true; do

+ 4 - 6
functions/command_debug.sh

@@ -31,7 +31,7 @@ fi
 echo ""
 echo ""
 echo -e "Use for identifying server issues only!"
 echo -e "Use for identifying server issues only!"
 echo -e "Press CTRL+c to drop out of debug mode."
 echo -e "Press CTRL+c to drop out of debug mode."
-fn_printwarningnl "If ${servicename} is already running it will be stopped."
+fn_print_warning_nl "If ${servicename} is already running it will be stopped."
 echo ""
 echo ""
 while true; do
 while true; do
 	read -e -i "y" -p "Continue? [Y/n]" yn
 	read -e -i "y" -p "Continue? [Y/n]" yn
@@ -42,16 +42,14 @@ while true; do
 esac
 esac
 done
 done
 fn_scriptlog "Starting debug"
 fn_scriptlog "Starting debug"
-fn_printinfonl "Stopping any running servers"
+fn_print_info_nl "Stopping any running servers"
 fn_scriptlog "Stopping any running servers"
 fn_scriptlog "Stopping any running servers"
 sleep 1
 sleep 1
 command_stop.sh
 command_stop.sh
-fn_printdots "Starting debug"
+fn_print_dots "Starting debug"
 sleep 1
 sleep 1
-fn_printok "Starting debug"
+fn_print_ok_nl "Starting debug"
 fn_scriptlog "Started debug"
 fn_scriptlog "Started debug"
-sleep 1
-echo -en "\n"
 cd "${executabledir}"
 cd "${executabledir}"
 fix.sh
 fix.sh
 if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
 if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then

+ 1 - 1
functions/command_details.sh

@@ -678,5 +678,5 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then
 elif [ "${gamename}" == "Rust" ]; then
 elif [ "${gamename}" == "Rust" ]; then
 	fn_details_rust
 	fn_details_rust
 else
 else
-	fn_printerrornl "Unable to detect server engine."
+	fn_print_error_nl "Unable to detect server engine."
 fi
 fi

+ 4 - 2
functions/command_dev_debug.sh

@@ -4,12 +4,14 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="281215"
 lgsm_version="281215"
 
 
+# Description: Dev only: enables debuging log to be saved to dev-debug.log.
+
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
 if [ -f ".dev-debug" ]; then
 if [ -f ".dev-debug" ]; then
 	rm .dev-debug
 	rm .dev-debug
-	fn_printoknl "Disabled dev-debug"
+	fn_print_ok_nl "Disabled dev-debug"
 else
 else
 	date > .dev-debug
 	date > .dev-debug
-	fn_printoknl "Enabled dev-debug"
+	fn_print_ok_nl "Enabled dev-debug"
 fi
 fi

+ 1 - 1
functions/command_email_test.sh

@@ -17,6 +17,6 @@ if [ "${emailnotification}" = "on" ]; then
 	actiontaken="Sent test email...hello is this thing on?"
 	actiontaken="Sent test email...hello is this thing on?"
 	email.sh
 	email.sh
 else
 else
-	fn_printfailnl "Notifications not enabled"
+	fn_print_fail_nl "Notifications not enabled"
 	fn_scriptlog "Notifications not enabled"
 	fn_scriptlog "Notifications not enabled"
 fi
 fi

+ 11 - 11
functions/command_install.sh

@@ -2,37 +2,37 @@
 # LGSM fn_install function
 # LGSM fn_install function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="260216"
 
 
+# Description: Overall function for the installer.
+
+local modulename="Install"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
 check.sh
 check.sh
 install_header.sh
 install_header.sh
-install_serverdir.sh
+install_server_dir.sh
+install_logs.sh
 check_deps.sh 
 check_deps.sh 
 # Download and install
 # Download and install
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
 if [ "${gamename}" == "Unreal Tournament 2004" ]; then
-	install_dl_ut2k4.sh
-	install_ut2k4.sh
+	install_server_files.sh
 	install_ut2k4_key.sh
 	install_ut2k4_key.sh
 elif [ "${gamename}" == "Unreal Tournament 99" ]; then
 elif [ "${gamename}" == "Unreal Tournament 99" ]; then
-	install_dl_ut99.sh
-	install_ut99.sh
+	install_server_files.sh
 elif [ "${gamename}" == "Teamspeak 3" ]; then
 elif [ "${gamename}" == "Teamspeak 3" ]; then
 	install_ts3.sh
 	install_ts3.sh
-elif [ ! -z "${appid}" ]; then
+elif [ -n "${appid}" ]; then
 	install_steamcmd.sh
 	install_steamcmd.sh
-	install_serverfiles.sh
+	install_server_files.sh
 fi
 fi
 
 
 # Configuration
 # Configuration
-fix.sh
-install_logs.sh
-install_gsquery.sh
 install_config.sh
 install_config.sh
 if [ "${gamename}" == "Counter Strike: Global Offensive" ]||[ "${gamename}" == "Team Fortress 2" ]||[ "${gamename}" == "BrainBread 2" ]; then
 if [ "${gamename}" == "Counter Strike: Global Offensive" ]||[ "${gamename}" == "Team Fortress 2" ]||[ "${gamename}" == "BrainBread 2" ]; then
 	install_gslt.sh
 	install_gslt.sh
 elif [ "${gamename}" == "Teamspeak 3" ]; then
 elif [ "${gamename}" == "Teamspeak 3" ]; then
 	install_ts3db.sh
 	install_ts3db.sh
 fi
 fi
+fix.sh
 install_complete.sh
 install_complete.sh

+ 79 - 85
functions/command_monitor.sh

@@ -10,106 +10,100 @@ lgsm_version="271215"
 local modulename="Monitor"
 local modulename="Monitor"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
-fn_monitor_teamspeak3(){
-check.sh
-logs.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-if [ ! -f "${rootdir}/${lockselfname}" ]; then
-	fn_printinfo "Disabled: No lock file found"
-	fn_scriptlog "Disabled: No lock file found"
-	sleep 1
-	echo -en "\n"
-	echo "To enable monitor run ./${selfname} start"
-	exit 1
-fi
-fn_printdots "Checking session: CHECKING"
-fn_scriptlog "Checking session: CHECKING"
-sleep 1
-info_ts3status.sh
-if [ "${ts3status}" = "Server is running" ]; then
-	fn_printok "Checking session: OK"
-	fn_scriptlog "Checking session: OK"
-	sleep 1
-	sleep 0.5
-	echo -en "\n"
-	exit
-else
-	fn_printfail "Checking session: FAIL"
-	fn_scriptlog "Checking session: FAIL"
-	sleep 1
-	fn_printfail "Checking session: FAIL: ${ts3status}"
-	fn_scriptlog "Checking session: FAIL: ${ts3status}"
-	failurereason="${ts3status}"
-	if [ "${emailnotification}" = "on" ]; then
-		subject="${servicename} Monitor - Restarting ${servername}"
-		actiontaken="restarted ${servername}"
-		email.sh
+fn_monitor_check_lockfile(){
+	# Monitor does not run it lockfile is not found
+	if [ ! -f "${rootdir}/${lockselfname}" ]; then
+		fn_print_info_nl "Disabled: No lock file found"
+		fn_scriptlog "Disabled: No lock file found"
+		echo "	* To enable monitor run ./${selfname} start"
+		exit 1
 	fi
 	fi
-fi
-sleep 0.5
-echo -en "\n"
-fn_restart
 }
 }
 
 
-fn_monitor_tmux(){
-check.sh
-info_config.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-if [ ! -f "${rootdir}/${lockselfname}" ]; then
-	fn_printinfo "Disabled: No lock file found"
-	fn_scriptlog "Disabled: No lock file found"
-	sleep 1
-	echo -en "\n"
-	echo "To enable monitor run ./${selfname} start"
-	exit 1
-fi
+fn_monitor_check_update(){
+	# Monitor will not check if update is running.
+	updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)
+	if [ "${updatecheck}" >= "0" ]; then
+		fn_print_info_nl "SteamCMD is currently checking for updates"
+		fn_scriptlog "SteamCMD is currently checking for updates"
+		sleep 1
+		exit
+	fi
+}
 
 
-updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)
-if [ "${updatecheck}" = "0" ]||[ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]; then
-	fn_printdots "Checking session: CHECKING"
+fn_monitor_msg_checking(){
+	fn_print_dots "Checking session: CHECKING"
 	fn_scriptlog "Checking session: CHECKING"
 	fn_scriptlog "Checking session: CHECKING"
-	sleep 1
-	tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
-	if [ "${tmuxwc}" -eq 1 ]; then
-		fn_printok "Checking session: OK"
+	sleep 1	
+}
+
+fn_monitor_email_notification(){
+	# Email will be sent if enabled
+	if [ "${emailnotification}" = "on" ]; then
+		subject="${servicename} Monitor - Starting ${servername}"
+		failurereason="${servicename} process not running"
+		actiontaken="${servicename} has been restarted"
+		email.sh
+	fi	
+}
+
+fn_monitor_teamspeak3(){
+	info_ts3status.sh
+	if [ "${ts3status}" = "Server is running" ]; then
+		fn_print_ok "Checking session: "
+		fn_print_ok_eol_nl
 		fn_scriptlog "Checking session: OK"
 		fn_scriptlog "Checking session: OK"
-		sleep 1
-		echo -en "\n"
+		exit
+	else
+		fn_print_fail "Checking session: ${ts3status}: "
+		fn_print_fail_eol_nl
+		fn_scriptlog "Checking session: ${ts3status}: FAIL"
+		failurereason="${ts3status}"
+		fn_monitor_email_notification
+	fi
+	fn_scriptlog "Monitor is starting ${servername}"
+	sleep 1
+	fn_restart
+}
 
 
-		if [ "${engine}" == "avalanche" ]||[ "${engine}" == "goldsource" ]||[ "${engine}" == "idtech3" ]||[ "${engine}" == "realvirtuality" ]||[ "${engine}" == "source" ]||[ "${engine}" == "spark" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
-			monitor_gsquery.sh
-		fi
-		exit $?
+fn_monitor_tmux(){
+	# checks that tmux session is running
+	tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
+	if [ "${tmuxwc}" == "1" ]; then
+		fn_print_ok "Checking session: OK"
+		fn_print_ok_eol_nl
+		fn_scriptlog "Checking session: OK"
+		# runs gsquery check on game with specific engines.
+		local allowed_engines_array=( avalanche goldsource realvirtuality source spark unity3d unreal unreal2 )
+		for allowed_engine in "${allowed_engines_array[@]}"
+		do
+			if [ "${allowed_engine}" == "${function_selfname}" ]; then
+				monitor_gsquery.sh
+			fi
+		done
+		exit
 	else
 	else
-		fn_printfail "Checking session: FAIL"
+		fn_print_fail "Checking session: "
+		fn_print_fail_eol_nl
 		fn_scriptlog "Checking session: FAIL"
 		fn_scriptlog "Checking session: FAIL"
-		sleep 1
-		echo -en "\n"
-		if [ "${emailnotification}" = "on" ]; then
-			subject="${servicename} Monitor - Starting ${servername}"
-			failurereason="${servicename} process not running"
-			actiontaken="${servicename} has been restarted"
-			email.sh
-		fi
+		fn_monitor_email_notification
 		fn_scriptlog "Monitor is starting ${servername}"
 		fn_scriptlog "Monitor is starting ${servername}"
+		sleep 1
 		command_start.sh
 		command_start.sh
 	fi
 	fi
-else
-	fn_printinfonl "SteamCMD is currently checking for updates"
-	fn_scriptlog "SteamCMD is currently checking for updates"
-	sleep 1
-	fn_printinfonl "When update is complete ${servicename} will start"
-	fn_scriptlog "When update is complete ${servicename} will start"
-	sleep 1
-fi
 }
 }
 
 
+check.sh
+logs.sh
+info_config.sh
+fn_print_dots "${servername}"
+fn_scriptlog "${servername}"
+sleep 1
+fn_monitor_check_lockfile
+fn_monitor_check_update
+fn_monitor_msg_checking
 if [ "${gamename}" == "Teamspeak 3" ]; then
 if [ "${gamename}" == "Teamspeak 3" ]; then
 	fn_monitor_teamspeak3
 	fn_monitor_teamspeak3
 else
 else
 	fn_monitor_tmux
 	fn_monitor_tmux
-fi
+fi

+ 58 - 70
functions/command_start.sh

@@ -10,69 +10,63 @@ local modulename="Starting"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
 fn_start_teamspeak3(){
 fn_start_teamspeak3(){
-check.sh
-info_ts3status.sh
+	check.sh
+	info_ts3status.sh
+
+	if [ "${ts3status}" != "Server is running" ]; then
+		# Will check for updates is updateonstart is yes
+		if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
+			update_check.sh
+		fi	
+	fi
 
 
-if [ "${ts3status}" != "Server is running" ]; then
-	# Will check for updates is updateonstart is yes
-	if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
-		update_check.sh
-	fi	
-fi
+	if [ ! -e "${servercfgfullpath}" ]; then
+		fn_print_warn_nl "${servercfgfullpath} is missing"
+		fn_scriptlog "${servercfgfullpath} is missing"
+		echo  "	* Creating blank ${servercfg}"
+		fn_scriptlog "Creating blank ${servercfg}"
+		sleep 2
+		echo  "	* ${servercfg} can remain blank by default."
+		fn_scriptlog "${servercfgfullpath} can remain blank by default."
+		sleep 2
+		echo  "	* ${servercfg} is located in ${servercfgfullpath}."
+		fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
+		sleep 5
+		touch "${servercfgfullpath}"
+	fi
 
 
-if [ ! -e "${servercfgfullpath}" ]; then
-	fn_printwarn "${servercfgfullpath} is missing"
-	fn_scriptlog "${servercfgfullpath} is missing"
-	sleep 2
-	echo -en "\n"
-	echo  "	* Creating blank ${servercfg}"
-	fn_scriptlog "Creating blank ${servercfg}"
-	sleep 2
-	echo  "	* ${servercfg} can remain blank by default."
-	fn_scriptlog "${servercfgfullpath} can remain blank by default."
-	sleep 2
-	echo  "	* ${servercfg} is located in ${servercfgfullpath}."
-	fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
-	sleep 5
-	touch "${servercfgfullpath}"
-fi
+	logs.sh
 
 
-logs.sh
+	fn_print_dots "${servername}"
+	fn_scriptlog "${servername}"
+	sleep 1
 
 
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
+	if [ "${ts3status}" == "Server is running" ]; then
+		fn_print_info_nl "${servername} is already running"
+		fn_scriptlog "${servername} is already running"
+		exit
+	fi
 
 
-if [ "${ts3status}" == "Server is running" ]; then
-	fn_printinfo "${servername} is already running"
-	fn_scriptlog "${servername} is already running"
+	mv "${scriptlog}" "${scriptlogdate}"
+	# Create lock file
+	date > "${rootdir}/${lockselfname}"
+	cd "${executabledir}"
+	if [ "${ts3serverpass}" == "1" ];then
+		./ts3server_startscript.sh start serveradmin_password="${newpassword}" 
+	else
+		./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
+	fi
 	sleep 1
 	sleep 1
-	echo -en "\n"
-	exit
-fi
-
-mv "${scriptlog}" "${scriptlogdate}"
-# Create lock file
-date > "${rootdir}/${lockselfname}"
-cd "${executabledir}"
-if [ "${ts3serverpass}" == "1" ];then
-	./ts3server_startscript.sh start serveradmin_password="${newpassword}" 
-else
-	./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
-fi
-sleep 1
-info_ts3status.sh
-if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}"	= "No server running (ts3server.pid is missing)" ]; then
-	fn_printfailnl "Unable to start ${servername}"
-	fn_scriptlog "Unable to start ${servername}"
-	echo -e "	Check log files: ${rootdir}/log"
-	exit 1
-else
-	fn_printok "${servername}"
-	fn_scriptlog "Started ${servername}"
-fi
-sleep 0.5
-echo -en "\n"
+	info_ts3status.sh
+	if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}"	= "No server running (ts3server.pid is missing)" ]; then
+		fn_print_fail_nl "Unable to start ${servername}"
+		fn_scriptlog "Unable to start ${servername}"
+		echo -e "	Check log files: ${rootdir}/log"
+		exit 1
+	else
+		fn_print_ok_nl "${servername}"
+		fn_scriptlog "Started ${servername}"
+	fi
 }
 }
 
 
 fn_start_tmux(){
 fn_start_tmux(){
@@ -90,7 +84,7 @@ if [ "${tmuxwc}" -eq 0 ]; then
 	fi
 	fi
 fi
 fi
 
 
-fn_printdots "${servername}"
+fn_print_dots "${servername}"
 fn_scriptlog "${servername}"
 fn_scriptlog "${servername}"
 sleep 1
 sleep 1
 
 
@@ -104,10 +98,8 @@ if [ "${tmuxwc}" -eq 0 ]; then
 fi
 fi
 
 
 if [ "${tmuxwc}" -eq 1 ]; then
 if [ "${tmuxwc}" -eq 1 ]; then
-	fn_printinfo "${servername} is already running"
+	fn_print_info_nl "${servername} is already running"
 	fn_scriptlog "${servername} is already running"
 	fn_scriptlog "${servername} is already running"
-	sleep 1
-	echo -en "\n"
 	exit
 	exit
 fi
 fi
 
 
@@ -132,24 +124,20 @@ sleep 1
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
 tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
 # If the server fails to start
 # If the server fails to start
 if [ "${tmuxwc}" -eq 0 ]; then
 if [ "${tmuxwc}" -eq 0 ]; then
-	fn_printfailnl "Unable to start ${servername}"
+	fn_print_fail_nl "Unable to start ${servername}"
 	fn_scriptlog "Unable to start ${servername}"
 	fn_scriptlog "Unable to start ${servername}"
 	sleep 1
 	sleep 1
 	if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
 	if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
-		fn_printfailnl "Unable to start ${servername}: Tmux error:"
+		fn_print_fail_nl "Unable to start ${servername}: Tmux error:"
 		fn_scriptlog "Tmux error"
 		fn_scriptlog "Tmux error"
-		sleep 1
-		echo -en "\n"
 		echo ""
 		echo ""
 		echo "Command"
 		echo "Command"
 		echo "================================="
 		echo "================================="
-		echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\""
-		echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" >> "${scriptlog}"
+		echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${scriptlog}"
 		echo ""
 		echo ""
 		echo "Error"
 		echo "Error"
 		echo "================================="
 		echo "================================="
-		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp"
-		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" >> "${scriptlog}"
+		cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${scriptlog}"
 
 
 		# Detected error http://gameservermanagers.com/issues
 		# Detected error http://gameservermanagers.com/issues
 		if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then
 		if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then
@@ -180,7 +168,7 @@ if [ "${tmuxwc}" -eq 0 ]; then
 	fi
 	fi
 exit 1	
 exit 1	
 else
 else
-	fn_printok "${servername}"
+	fn_print_ok "${servername}"
 	fn_scriptlog "Started ${servername}"
 	fn_scriptlog "Started ${servername}"
 fi
 fi
 rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
 rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"

+ 194 - 136
functions/command_stop.sh

@@ -9,151 +9,209 @@ lgsm_version="271215"
 local modulename="Stopping"
 local modulename="Stopping"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
-sdtd_telnet(){
-    sdtdshutdown=$( expect -c '
-    proc abort {} {
-        puts "Timeout or EOF\n"
-        exit 1
-    }
-    spawn telnet '"${telnetip}"' '"${telnetport}"'
-    expect {
-        "password:"     { send "'"${telnetpass}"'\r" }
-        default         abort
-    }
-    expect {
-        "session."  { send "shutdown\r" }
-        default         abort
-    }
-    expect { eof }
-    puts "Completed.\n"
-    ')
+# Attempts Graceful of source using rcon 'quit' command.
+fn_stop_graceful_source(){
+	fn_print_dots "Graceful: rcon quit"
+	fn_scriptlog "Graceful: rcon quit"
+	# sends quit
+	tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
+	# waits up to 30 seconds giving the server time to shutdown gracefuly
+	for seconds in {1..30}; do
+		pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
+		if [ "${pid}" == "0" ]; then
+			fn_print_ok "Graceful: rcon quit: ${seconds}: "
+			fn_print_ok_eol_nl
+			fn_scriptlog "Graceful: rcon quit: OK: ${seconds} seconds"
+			break
+		fi
+		sleep 1
+		fn_print_dots "Graceful: rcon quit: ${seconds}"
+	done
+	if [ "${pid}" != "0" ]; then
+		fn_print_fail "Graceful: rcon quit"
+		fn_print_fail_eol_nl
+		fn_scriptlog "Graceful: rcon quit: FAIL"
+		fn_stop_tmux
+	fi
+	sleep 1
 }
 }
 
 
-fn_stop_teamspeak3(){
-check.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
-info_ts3status.sh
-if [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
-    fn_printfail "${servername} is already stopped"
-    fn_scriptlog "${servername} is already stopped"
-else
-    ${filesdir}/ts3server_startscript.sh stop > /dev/null 2>&1
-    fn_printok "${servername}"
-    fn_scriptlog "Stopped ${servername}"
-fi
-# Remove lock file
-rm -f "${rootdir}/${lockselfname}"
-sleep 1
-echo -en "\n"
+# Attempts Graceful of goldsource using rcon 'quit' command.
+# Goldsource 'quit' command restarts rather than shutsdown
+# this function will only wait 3 seconds then force a tmux shutdown.
+# preventing the server from coming back online.
+fn_stop_graceful_goldsource(){
+	fn_print_dots "Graceful: rcon quit"
+	fn_scriptlog "Graceful: rcon quit"
+	# sends quit
+	tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
+	# waits 3 seconds as goldsource servers restart with the quit command
+	for seconds in {1..3}; do
+		sleep 1
+		fn_print_dots "Graceful: rcon quit: ${seconds}"
+	done
+	fn_print_ok "Graceful: rcon quit: ${seconds}: "
+	fn_print_ok_eol_nl
+	fn_scriptlog "Graceful: rcon quit: OK: ${seconds} seconds"
+	sleep 1
+	fn_stop_tmux
 }
 }
 
 
-fn_stop_tmux(){
-check.sh
-info_config.sh
-fn_printdots "${servername}"
-fn_scriptlog "${servername}"
-sleep 1
+# Attempts Graceful of 7 Days To Die using telnet.
+fn_stop_telnet_sdtd(){
+	sdtd_telnet_shutdown=$( expect -c '
+	proc abort {} {
+		puts "Timeout or EOF\n"
+		exit 1
+	}
+	spawn telnet '"${telnetip}"' '"${telnetport}"'
+	expect {
+		"password:"     { send "'"${telnetpass}"'\r" }
+		default         abort
+	}
+	expect {
+		"session."  { send "shutdown\r" }
+		default         abort
+	}
+	expect { eof }
+	puts "Completed.\n"
+	')
+	
+}
 
 
-if [ "${gamename}" == "7 Days To Die" ] ; then
-    # if game is 7 Days To Die, we need special, graceful shutdown via telnet connection.
-    # Set below variable to be called for expect to operate correctly..
-    fn_printdots "Attempting graceful shutdown via telnet"
-    fn_scriptlog "Attempting graceful shutdown via telnet"
-    sleep 1
-    telnetip=127.0.0.1
-    sdtd_telnet
+fn_stop_graceful_sdtd(){
+	fn_print_dots "Graceful: telnet"
+	fn_scriptlog "Graceful: telnet"
+	sleep 1
+	if [ "${telnetenabled}" == "false" ]; then
+		fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}"
+	elif [ "$(command -v expect)" ]||[ "$(which expect >/dev/null 2>&1)" ]; then
+		# Tries to shutdown with both localhost and server IP.
+		for telnetip in 127.0.0.1 ${ip}; do
+			fn_print_dots "Graceful: telnet: ${telnetip}"
+			fn_scriptlog "Graceful: telnet: ${telnetip}"
+			sleep 1
+			fn_stop_telnet_sdtd
+			completed=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Completed.")
+			refused=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Timeout or EOF")
+			if [ -n "${refused}" ]; then
+				fn_print_warn "Graceful: telnet: ${telnetip}: "
+				fn_print_fail_eol_nl
+				fn_scriptlog "Graceful: telnet: ${telnetip}: FAIL"
+				sleep 1
+			elif [ -n "${completed}" ]; then
+				break
+			fi
+		done
 
 
-    # If failed using localhost will use servers ip
-    refused=$(echo -en "\n ${sdtdshutdown}"| grep "Timeout or EOF")
-    if [ -n "${refused}" ]; then
-        telnetip=${ip}
-        fn_printwarn "Attempting graceful shutdown via telnet: localhost failed"
-        fn_scriptlog "Warning! Attempting graceful shutdown failed using localhost"
-        sleep 5
-        echo -en "\n"
-        fn_printdots "Attempting graceful shutdown via telnet: using ${telnetip}"
-        fn_scriptlog "Attempting graceful shutdown via telnet using ${telnetip}"
-        sdtd_telnet
-        sleep 1
-    fi
+		# If telnet was successful will use telnet again to check the connection has closed
+		# This confirms that the tmux session can now be killed.
+		if [ -n "${completed}" ]; then
+			for seconds in {1..30}; do
+				fn_stop_telnet_sdtd
+				refused=$(echo -en "\n ${sdtd_telnet_shutdown}"|grep "Timeout or EOF")
+				if [ -n "${refused}" ]; then
+					fn_print_ok "Graceful: telnet: ${telnetip}: "
+					fn_print_ok_eol_nl
+					fn_scriptlog "Graceful: telnet: ${telnetip}: ${seconds} seconds"
+					break
+				fi
+				sleep 1
+				fn_print_dots "Graceful: rcon quit: ${seconds}"
+			done
+		# If telnet failed will go straight to tmux shutdown. 
+		# If cannot shutdown correctly world save may be lost
+		else
+			if [ -n "${refused}" ]; then
+				fn_print_fail "Graceful: telnet: "
+				fn_print_fail_eol_nl
+				fn_scriptlog "Graceful: telnet: ${telnetip}: FAIL"
+			else
+				fn_print_fail_nl "Graceful: telnet: Unknown error"
+				fn_scriptlog "Graceful: telnet: Unknown error"
+			fi
+			echo -en "\n" | tee -a "${scriptlog}"
+			echo -en "Telnet output:" | tee -a "${scriptlog}"
+			echo -en "\n ${sdtd_telnet_shutdown}" | tee -a "${scriptlog}"
+			echo -en "\n\n" | tee -a "${scriptlog}"
+		fi
+	else
+		fn_print_dots "Graceful: telnet: "
+		fn_scriptlog "Graceful: telnet: "
+		fn_print_fail "Graceful: telnet: expect not installed: "
+		fn_print_fail_eol_nl
+		fn_scriptlog "Graceful: telnet: expect not installed: FAIL"
+	fi
+	sleep 1
+	fn_stop_tmux
+}
 
 
-    refused=$(echo -en "\n ${sdtdshutdown}"| grep "Timeout or EOF")
-    completed=$(echo -en "\n ${sdtdshutdown}"| grep "Completed.")
-    if [ -n "${refused}" ]; then
-        fn_printfail "Attempting graceful shutdown via telnet"
-         fn_scriptlog "Attempting graceful shutdown failed"
-         fn_scriptlog "${refused}"
-    elif [ -n "${completed}" ]; then
-        fn_printok "Attempting graceful shutdown via telnet"
-        fn_scriptlog "Attempting graceful shutdown succeeded"
-    else
-         fn_printfail "Attempting graceful shutdown via telnet: Unknown error"
-         fn_scriptlog "Attempting graceful shutdown failed"
-         fn_scriptlog "Unknown error"
-    fi
-    sleep 1
-    echo -en "\n\n"
-    echo -en "Telnet output:"
-    echo -en "\n ${sdtdshutdown}"
-    echo -en "\n\n"
-    sleep 1
-    fn_printdots "${servername}"
-    fn_scriptlog "${servername}"
-    sleep 5
-    pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
-    if [ "${pid}" == "0" ]; then
-        fn_printok "${servername} is already stopped using graceful shutdown"
-        fn_scriptlog "${servername} is already stopped using graceful shutdown"
-    else
-        tmux kill-session -t "${servicename}"
-        fn_printok "${servername}"
-        fn_scriptlog "Stopped ${servername}"
-    fi
+fn_stop_graceful_select(){
+	if [ "${gamename}" == "7 Days To Die" ]; then
+		fn_stop_graceful_sdtd
+	elif [ "${engine}" == "source" ]; then
+		fn_stop_graceful_source
+	elif [ "${engine}" == "goldsource" ]; then
+		fn_stop_graceful_goldsource
+	else
+		fn_stop_tmux
+	fi		
+}
 
 
-else
-    pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
-    if [ "${pid}" == "0" ]; then
-        fn_printfail "${servername} is already stopped"
-        fn_scriptlog "${servername} is already stopped"
-    else
+fn_stop_teamspeak3(){
+	fn_print_dots "${servername}"
+	fn_scriptlog "${servername}"
+	sleep 1
+	${filesdir}/ts3server_startscript.sh stop > /dev/null 2>&1
+	# Remove lock file
+	rm -f "${rootdir}/${lockselfname}"
+	fn_print_ok_nl "${servername}"
+	fn_scriptlog "Stopped ${servername}"
+	}
 
 
-        if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
-            sleep 1
-            fn_printdots "Attempting graceful shutdown"
-            fn_scriptlog "Attempting graceful shutdown"
-            tmux send -t "${servicename}" quit ENTER > /dev/null 2>&1
-            counter=0
-            while [ "${pid}" != "0" -a $counter -lt 30 ]; do
-                pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
-                sleep 1
-                let counter=counter+1
-                if [  "${counter}" -gt "1" ]; then
-                    fn_printdots "Attempting graceful shutdown: ${counter}"
-                fi    
-            done
-            pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
-            if [ "${pid}" == "0" ]; then
-                fn_printok "Attempting graceful shutdown"
-            else
-                fn_printfail "Attempting graceful shutdown"
-            fi
-        fi
+	fn_stop_tmux(){
+	fn_print_dots "${servername}"
+	fn_scriptlog "tmux kill-session: ${servername}"
+	sleep 1
+	# Kill tmux session
+	tmux kill-session -t "${servicename}" > /dev/null 2>&1
+	sleep 0.5
+	pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
+	if [ "${pid}" == "0" ]; then
+		# Remove lock file
+		rm -f "${rootdir}/${lockselfname}"
+		fn_print_ok_nl "${servername}"
+		fn_scriptlog "Stopped ${servername}"
+	else
+		fn_print_fail_nl "Unable to stop${servername}"
+		fn_scriptlog "Unable to stop${servername}"
+	fi
+}
 
 
-        tmux kill-session -t "${servicename}" > /dev/null 2>&1
-        fn_printok "${servername}"
-        fn_scriptlog "Stopped ${servername}"
-    fi
-fi
-    # Remove lock file
-    rm -f "${rootdir}/${lockselfname}"
-    sleep 1
-    echo -en "\n"
+# checks if the server is already stopped before trying to stop.
+fn_stop_pre_check(){
+	if [ "${gamename}" == "Teamspeak 3" ]; then
+		info_ts3status.sh
+		if [ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
+			fn_print_ok_nl "${servername} is already stopped"
+			fn_scriptlog "${servername} is already stopped"
+		else
+			fn_stop_teamspeak3
+		fi      
+	else
+		pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
+		if [ "${pid}" == "0" ]; then
+			fn_print_ok_nl "${servername} is already stopped"
+			fn_scriptlog "${servername} is already stopped"
+		else
+			fn_stop_graceful_select
+		fi
+	fi
 }
 }
 
 
-if [ "${gamename}" == "Teamspeak 3" ]; then
-    fn_stop_teamspeak3
-else
-    fn_stop_tmux
-fi
+check.sh
+info_config.sh
+fn_print_dots "${servername}"
+fn_scriptlog "${servername}"
+sleep 1
+fn_stop_pre_check

+ 5 - 5
functions/command_ts3_server_pass.sh

@@ -17,8 +17,8 @@ echo "${gamename} ServerAdmin Password Change"
 echo "============================"
 echo "============================"
 echo ""
 echo ""
 echo "Press \"CTRL+b d\" to exit console."
 echo "Press \"CTRL+b d\" to exit console."
-fn_printinfomationnl "You are about to change the ${gamename} ServerAdmin password."
-fn_printwarningnl "${gamename} will restart during this process."
+fn_print_infomation_nl "You are about to change the ${gamename} ServerAdmin password."
+fn_print_warning_nl "${gamename} will restart during this process."
 echo ""
 echo ""
 while true; do
 while true; do
 	read -e -i "y" -p "Continue? [y/N]" yn
 	read -e -i "y" -p "Continue? [y/N]" yn
@@ -34,18 +34,18 @@ read -p "Enter new password : " newpassword
 
 
 
 
 fn_serveradmin_password_set(){
 fn_serveradmin_password_set(){
-fn_printinfonl "Applying new password"
+fn_print_info_nl "Applying new password"
 fn_scriptlog "Applying new password"
 fn_scriptlog "Applying new password"
 sleep 1
 sleep 1
 # Stop any running server
 # Stop any running server
 command_stop.sh
 command_stop.sh
 # Start server in "new password mode"
 # Start server in "new password mode"
 ts3serverpass="1"
 ts3serverpass="1"
-fn_printinfonl "Starting server with new password"
+fn_print_info_nl "Starting server with new password"
 command_start.sh
 command_start.sh
 # Stop server in "new password mode"
 # Stop server in "new password mode"
 command_stop.sh
 command_stop.sh
-fn_printoknl "Password applied"
+fn_print_ok_nl "Password applied"
 fn_scriptlog "New ServerAdmin password applied"
 fn_scriptlog "New ServerAdmin password applied"
 sleep 1
 sleep 1
 }
 }

+ 19 - 6
functions/update_functions.sh → functions/command_update_functions.sh

@@ -2,23 +2,36 @@
 # LGSM update_functions.sh function
 # LGSM update_functions.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="230116"
+lgsm_version="270216"
 
 
 # Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
 # Description: Deletes the functions dir to allow re-downloading of functions from GitHub.
 
 
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 check.sh
 check.sh
-fn_printdots "Updating functions"
+fn_print_dots "Updating functions"
 fn_scriptlog "Updating functions"
 fn_scriptlog "Updating functions"
 sleep 1
 sleep 1
 echo -ne "\n"
 echo -ne "\n"
-rm -rfv "${rootdir}/functions/"*
-exitcode=$?
+
+# Removed legecy functions dir
+if [ -d "${rootdir}/functions/" ]; then
+	rm -rfv "${rootdir}/functions/"
+	exitcode=$?
+fi
+
+if [ -n "${functionsdir}" ]; then
+	rm -rfv "${functionsdir}/"*
+	exitcode=$?
+else
+	fn_print_fail "Updating functions"
+	fn_scriptlog "Failure! Updating functions"	
+fi
+
 if [ "${exitcode}" == "0" ]; then
 if [ "${exitcode}" == "0" ]; then
-	fn_printok "Updating functions"
+	fn_print_ok "Updating functions"
 	fn_scriptlog "Success! Updating functions"
 	fn_scriptlog "Success! Updating functions"
 else
 else
-	fn_printfail "Updating functions"
+	fn_print_fail "Updating functions"
 	fn_scriptlog "Failure! Updating functions"
 	fn_scriptlog "Failure! Updating functions"
 fi
 fi
 echo -ne "\n"
 echo -ne "\n"

+ 5 - 7
functions/command_validate.sh

@@ -10,15 +10,13 @@ local modulename="Validate"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 
 fn_validation(){
 fn_validation(){
-fn_printwarn "Validating may overwrite some customised files."
-sleep 1
-echo -en "\n"
+fn_print_warn_nl "Validating may overwrite some customised files."
 echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
 echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
 sleep 5
 sleep 5
 echo -en "\n"
 echo -en "\n"
-fn_printdots "Checking server files"
+fn_print_dots "Checking server files"
 sleep 1
 sleep 1
-fn_printok "Checking server files"
+fn_print_ok "Checking server files"
 fn_scriptlog "Checking server files"
 fn_scriptlog "Checking server files"
 sleep 1
 sleep 1
 
 
@@ -29,9 +27,9 @@ if [ $(command -v unbuffer) ]; then
 fi
 fi
 
 
 if [ "${engine}" == "goldsource" ]; then
 if [ "${engine}" == "goldsource" ]; then
-	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
+	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +app_update "${appid}" validate +quit| tee -a "${scriptlog}"
 else
 else
-	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
+	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit| tee -a "${scriptlog}"
 fi
 fi
 
 
 fix.sh
 fix.sh

+ 202 - 0
functions/core_dl.sh

@@ -0,0 +1,202 @@
+#!/bin/bash
+# LGSM core_dl.sh function
+# Author: Daniel Gibbs
+# Website: http://gameservermanagers.com
+lgsm_version="050216"
+
+# Description: Deals with all downloads for LGSM.
+
+# fileurl: The URL of the file: http://example.com/dl/File.tar.bz2
+# filedir: location the file is to be saved: /home/server/lgsm/tmp
+# filename: name of file (this can be different from the url name): file.tar.bz2
+# executecmd: Optional, set to "executecmd" to make file executable using chmod +x
+# run: Optional, set to run to execute the file
+# force: Optional, force re-download of file even if exists
+# md5: Optional, Checks file against an md5 sum
+#
+# Downloads can be defined in code like so:
+# fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+# fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "executecmd" "run" "force" "10cd7353aa9d758a075c600a6dd193fd"
+
+fn_dl_md5(){
+# Runs MD5 Check if available
+if [ "${md5}" != "0" ]&&[ "${md5}" != "nomd5" ]; then
+	echo -ne "verifying ${filename} with MD5..."
+	sleep 1
+	local md5sumcmd=$(md5sum "${filedir}/${filename}"|awk '{print $1;}')
+	if [ "${md5sumcmd}" != "${md5}" ]; then
+		fn_print_fail_eol_nl
+		echo "${filename} returned MD5 checksum: ${md5sumcmd}"
+		echo "expected MD5 checksum: ${md5}"
+		fn_scriptlog "verifying ${filename} with MD5: FAIL"
+		fn_scriptlog "${filename} returned MD5 checksum: ${md5sumcmd}"
+		fn_scriptlog "expected MD5 checksum: ${md5}"
+		exit 1	
+	else
+		fn_print_ok_eol_nl
+		fn_scriptlog "verifying ${filename} with MD5: OK"
+		fn_scriptlog "${filename} returned MD5 checksum: ${md5sumcmd}"
+		fn_scriptlog "expected MD5 checksum: ${md5}"		
+	fi
+fi	
+}
+
+# Extracts bzip2 or gzip files
+# Extracts can be defined in code like so:
+# fn_dl_extract "${filedir}" "${filename}" "${extractdir}"
+# fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles"
+fn_dl_extract(){
+filedir="${1}"
+filename="${2}"
+extractdir="${3}"
+# extracts archives
+echo -ne "extracting ${filename}..."
+fn_scriptlog "extracting download"
+mime=$(file -b --mime-type "${filedir}/${filename}")
+
+if [ "${mime}" == "application/gzip" ]; then
+	tarcmd=$(tar -zxf "${filedir}/${filename}" -C "${extractdir}")
+elif [ "${mime}" == "application/x-bzip2" ]; then
+	tarcmd=$(tar -jxf "${filedir}/${filename}" -C "${extractdir}")
+fi
+local exitcode=$?
+if [ ${exitcode} -ne 0 ]; then
+	fn_print_fail_eol_nl
+	fn_scriptlog "extracting download: FAIL"
+	echo "${tarcmd}" | tee -a "${scriptlog}"
+	exit ${exitcode}
+else
+	fn_print_ok_eol_nl
+fi
+}
+
+# Trap to remove file download if canceled before completed
+fn_fetch_trap() {
+	echo ""
+	echo -ne "downloading ${filename}: "
+	fn_print_canceled_eol_nl
+	fn_scriptlog "downloading ${filename}: CANCELED"
+	sleep 1
+	rm -f "${filedir}/${filename}" | tee -a "${scriptlog}"
+	echo -ne "downloading ${filename}: "
+	fn_print_removed_eol_nl
+	fn_scriptlog "downloading ${filename}: REMOVED"
+	exit
+}
+
+fn_fetch_file(){
+fileurl="${1}"
+filedir="${2}"
+filename="${3}"
+executecmd="${4:-0}"
+run="${5:-0}"
+force="${6:-0}"
+md5="${7:-0}"
+
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+	if [ ! -d "${filedir}" ]; then
+		mkdir -p "${filedir}"
+	fi
+	
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl $(echo $PATH | sed "s/\([:]\|\$\)/\/curl /g")"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		# trap to remove part downloaded files
+		trap fn_fetch_trap INT
+		# if larger file shows progress bar
+		if [ ${filename##*.} == "bz2" ]; then
+			echo -ne "downloading ${filename}..."
+			sleep 1
+			curlcmd=$(${curlcmd} --progress-bar --fail -o "${filedir}/${filename}" "${fileurl}")
+			echo -ne "downloading ${filename}..."
+		else
+			echo -ne "    fetching ${filename}...\c"
+			curlcmd=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${fileurl}" 2>&1)
+		fi
+		local exitcode=$?
+		if [ ${exitcode} -ne 0 ]; then
+			fn_print_fail_eol_nl
+			if [ -f "${scriptlog}" ]; then
+				fn_scriptlog "downloading ${filename}: FAIL"
+			fi	
+			echo "${curlcmd}" | tee -a "${scriptlog}"
+			echo -e "${fileurl}\n" | tee -a "${scriptlog}"
+			exit ${exitcode}
+		else
+			fn_print_ok_eol_nl
+			if [ -f "${scriptlog}" ]; then
+				fn_scriptlog "downloading ${filename}: OK"
+			fi	
+		fi
+		# remove trap
+		trap - INT	
+	else
+		fn_print_fail_eol_nl
+		echo "Curl is not installed!"
+		echo -e ""
+		exit 1
+	fi
+	# make file executecmd if executecmd is set
+	if [ "${executecmd}" == "executecmd" ]; then
+		chmod +x "${filedir}/${filename}"
+	fi	
+fi
+
+if [ -f "${filedir}/${filename}" ]; then
+	fn_dl_md5
+	# run file if run is set
+	if [ "${run}" == "run" ]; then
+		source "${filedir}/${filename}"
+	fi
+fi	
+}
+
+
+
+# fileurl: The directory the file is located in teh GitHub repo
+# filedir: name of file
+# filename: location file to be saved
+# executecmd: set to "executecmd" to make file executecmd
+# run: Optional, set to run to execute the file
+# force: force download of file even if exists
+# md5: Checks fail against an md5 sum
+
+
+# Fetches files from the github repo
+fn_fetch_file_github(){
+github_file_url_dir="${1}"
+github_file_url_name="${2}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+fileurl="${githuburl}"
+filedir="${3}"
+filename="${github_file_url_name}"
+executecmd="${4:-0}"
+run="${5:-0}"
+force="${6:-0}"
+md5="${7:-0}"
+fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+}
+
+
+# Fetches functions
+fn_fetch_function(){
+github_file_url_dir="functions" # github dir containing the file
+github_file_url_name="${functionfile}" # name of the github file
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+fileurl="${githuburl}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+executecmd="executecmd"
+run="run"
+force="noforce"
+md5="nomd5"
+fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+}

+ 140 - 89
functions/core_functions.sh

@@ -2,87 +2,149 @@
 # LGSM core_functions.sh function
 # LGSM core_functions.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
+<<<<<<< HEAD
 lgsm_version="190216"
 lgsm_version="190216"
+=======
+lgsm_version="270216"
+>>>>>>> dlmanage
 
 
-# Description: Defines all functions to allow download and execution of functions using fn_runfunction.
+# Description: Defines all functions to allow download and execution of functions using fn_fetch_function.
 # This function is called first before any other function. Without this file other functions would not load.
 # This function is called first before any other function. Without this file other functions would not load.
 
 
-#Legacy functions
+# Code/functions for legacy servers
 
 
 fn_functions(){
 fn_functions(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fn_getopt(){
 fn_getopt(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
+}
+
+# fn_fetch_core_dl also placed here to allow legecy servers to still download core functions
+if [ -z "${lgsmdir}" ]; then
+	lgsmdir="${rootdir}/lgsm"
+	functionsdir="${lgsmdir}/functions"
+fi 
+
+fn_fetch_core_dl(){
+github_file_url_dir="functions"
+github_file_url_name="${functionfile}"
+filedir="${functionsdir}"
+filename="${github_file_url_name}"
+githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
+# If the file is missing, then download
+if [ ! -f "${filedir}/${filename}" ]; then
+	if [ ! -d "${filedir}" ]; then
+		mkdir -p "${filedir}"
+	fi
+	echo -e "    fetching ${filename}...\c"
+	# Check curl exists and use available path
+	curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl $(echo $PATH | sed "s/\([:]\|\$\)/\/curl /g")"
+	for curlcmd in ${curlpaths}
+	do
+		if [ -x "${curlcmd}" ]; then
+			break
+		fi
+	done
+	# If curl exists download file
+	if [ "$(basename ${curlcmd})" == "curl" ]; then
+		curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
+		if [ $? -ne 0 ]; then
+			echo -e "\e[0;31mFAIL\e[0m\n"
+			echo "${curlfetch}"
+			echo -e "${githuburl}\n"
+			exit 1
+		else
+			echo -e "\e[0;32mOK\e[0m"
+		fi		
+	else
+		echo -e "\e[0;31mFAIL\e[0m\n"
+		echo "Curl is not installed!"
+		echo -e ""
+		exit 1
+	fi
+	chmod +x "${filedir}/${filename}"
+fi
+source "${filedir}/${filename}"
 }
 }
 
 
 
 
 # Core
 # Core
 
 
+core_dl.sh(){
+# Functions are defined in core_functions.sh.
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
+
 core_getopt.sh(){
 core_getopt.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
 }
 }
 
 
 core_messages.sh(){
 core_messages.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_core_dl
 }
 }
 
 
+core_dl.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_core_dl
+}
 
 
 # Command
 # Command
 
 
 command_console.sh(){
 command_console.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_debug.sh(){
 command_debug.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_details.sh(){
 command_details.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_email_test.sh(){
 command_email_test.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_backup.sh(){
 command_backup.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_monitor.sh(){
 command_monitor.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_start.sh(){
 command_start.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_stop.sh(){
 command_stop.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_validate.sh(){
 command_validate.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_install.sh(){
 command_install.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_fastdl.sh(){
 command_fastdl.sh(){
@@ -92,13 +154,15 @@ fn_runfunction
 
 
 command_ts3_server_pass.sh(){
 command_ts3_server_pass.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fn_restart(){
 fn_restart(){
 local modulename="Restarting"
 local modulename="Restarting"
 info_config.sh
 info_config.sh
-fn_scriptlog "${servername}"
+if [ -d "${scriptlogdir}" ]; then
+	fn_scriptlog "${servername}"
+fi	
 command_stop.sh
 command_stop.sh
 command_start.sh
 command_start.sh
 }
 }
@@ -108,52 +172,47 @@ command_start.sh
 
 
 check.sh(){
 check.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 check_config.sh(){
 check_config.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 check_deps.sh(){
 check_deps.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 check_ip.sh(){
 check_ip.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 check_logs.sh(){
 check_logs.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 check_root.sh(){
 check_root.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 check_steamcmd.sh(){
 check_steamcmd.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
-check_steamuser.sh(){
+check_system_dir.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-check_systemdir.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 check_tmux.sh(){
 check_tmux.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 
 
@@ -161,12 +220,12 @@ fn_runfunction
 
 
 compress_unreal2_maps.sh(){
 compress_unreal2_maps.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 compress_ut99_maps.sh(){
 compress_ut99_maps.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 
 
@@ -174,12 +233,12 @@ fn_runfunction
 
 
 command_dev_debug.sh(){
 command_dev_debug.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 command_dev_detect_deps.sh(){
 command_dev_detect_deps.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 
 
@@ -187,52 +246,52 @@ fn_runfunction
 
 
 fix.sh(){
 fix.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_arma3.sh(){
 fix_arma3.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_csgo.sh(){
 fix_csgo.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_dst.sh(){
 fix_dst.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_ins.sh(){
 fix_ins.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_steamcmd.sh(){
 fix_steamcmd.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_glibc.sh(){
 fix_glibc.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_ro.sh(){
 fix_ro.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_kf.sh(){
 fix_kf.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_ut2k4.sh(){
 fix_ut2k4.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 
 
@@ -240,22 +299,22 @@ fn_runfunction
 
 
 info_config.sh(){
 info_config.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 info_distro.sh(){
 info_distro.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 info_glibc.sh(){
 info_glibc.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 info_ts3status.sh(){
 info_ts3status.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 
 
@@ -263,14 +322,14 @@ fn_runfunction
 
 
 email.sh(){
 email.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 # Logs
 # Logs
 
 
 logs.sh(){
 logs.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 
 
@@ -278,30 +337,29 @@ fn_runfunction
 
 
 monitor_gsquery.sh(){
 monitor_gsquery.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
-
 # Update
 # Update
 
 
 update_check.sh(){
 update_check.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
-update_functions.sh(){
+command_update_functions.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 update_dl.sh(){
 update_dl.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
-update_functions.sh(){
+fn_update_functions.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 
 
@@ -316,92 +374,85 @@ command_install.sh
 
 
 install_complete.sh(){
 install_complete.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_config.sh(){
 install_config.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_gsquery.sh(){
 install_gsquery.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_gslt.sh(){
 install_gslt.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_header.sh(){
 install_header.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_logs.sh(){
 install_logs.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_retry.sh(){
 install_retry.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
-install_serverdir.sh(){
+install_server_dir.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
-install_serverfiles.sh(){
+install_server_files.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_steamcmd.sh(){
 install_steamcmd.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_ts3.sh(){
 install_ts3.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_ts3db.sh(){
 install_ts3db.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_ut2k4.sh(){
 install_ut2k4.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_dl_ut2k4.sh(){
 install_dl_ut2k4.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 install_ut2k4_key.sh(){
 install_ut2k4_key.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_ut99.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
-}
-
-install_dl_ut99.sh(){
-functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 fix_ut99.sh(){
 fix_ut99.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
-fn_runfunction
+fn_fetch_function
 }
 }
 
 
 # Calls on-screen messages
 # Calls on-screen messages
 core_messages.sh
 core_messages.sh
+
+#Calls file downloader
+core_dl.sh

+ 16 - 7
functions/core_getopt.sh

@@ -20,7 +20,7 @@ case "$getopt" in
 		forceupdate=1;
 		forceupdate=1;
 		update_check.sh;;
 		update_check.sh;;
 	uf|update-functions)
 	uf|update-functions)
-		update_functions.sh;;
+		command_update_functions.sh;;
 	v|validate)
 	v|validate)
 		command_validate.sh;;
 		command_validate.sh;;
 	m|monitor)
 	m|monitor)
@@ -81,7 +81,7 @@ case "$getopt" in
 	u|update)
 	u|update)
 		update_check.sh;;
 		update_check.sh;;
 	uf|update-functions)
 	uf|update-functions)
-		update_functions.sh;;
+		command_update_functions.sh;;
 	m|monitor)
 	m|monitor)
 		command_monitor.sh;;
 		command_monitor.sh;;
 	et|email-test)
 	et|email-test)
@@ -133,7 +133,7 @@ case "$getopt" in
 	r|restart)
 	r|restart)
 		fn_restart;;
 		fn_restart;;
 	uf|update-functions)
 	uf|update-functions)
-		update_functions.sh;;
+		command_update_functions.sh;;
 	m|monitor)
 	m|monitor)
 		command_monitor.sh;;
 		command_monitor.sh;;
 	et|email-test)
 	et|email-test)
@@ -183,7 +183,7 @@ case "$getopt" in
 		forceupdate=1;
 		forceupdate=1;
 		update_check.sh;;
 		update_check.sh;;
 	uf|update-functions)
 	uf|update-functions)
-		update_functions.sh;;
+		command_update_functions.sh;;
 	v|validate)
 	v|validate)
 		command_validate.sh;;
 		command_validate.sh;;
 	m|monitor)
 	m|monitor)
@@ -245,7 +245,7 @@ case "$getopt" in
 	r|restart)
 	r|restart)
 		fn_restart;;
 		fn_restart;;
 	uf|update-functions)
 	uf|update-functions)
-		update_functions.sh;;
+		command_update_functions.sh;;
 	m|monitor)
 	m|monitor)
 		command_monitor.sh;;
 		command_monitor.sh;;
 	et|email-test)
 	et|email-test)
@@ -262,6 +262,8 @@ case "$getopt" in
 		command_dev_debug.sh;;		
 		command_dev_debug.sh;;		
 	i|install)
 	i|install)
 		command_install.sh;;
 		command_install.sh;;
+	ai|auto-install)
+		fn_autoinstall;;		
 	mc|map-compressor)
 	mc|map-compressor)
 		compress_ut99_maps.sh;;
 		compress_ut99_maps.sh;;
 	dd|depsdetect)
 	dd|depsdetect)
@@ -284,6 +286,7 @@ case "$getopt" in
 		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
 		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
 		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
 		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
 		echo -e "\e[34minstall\t\e[0mInstall the server."
 		echo -e "\e[34minstall\t\e[0mInstall the server."
+		echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
 		echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
 		echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
 	} | column -s $'\t' -t 
 	} | column -s $'\t' -t 
 	esac
 	esac
@@ -305,7 +308,7 @@ case "$getopt" in
 		forceupdate=1;
 		forceupdate=1;
 		update_check.sh;;
 		update_check.sh;;
 	uf|update-functions)
 	uf|update-functions)
-		update_functions.sh;;
+		command_update_functions.sh;;
 	v|validate)
 	v|validate)
 		command_validate.sh;;
 		command_validate.sh;;
 	m|monitor)
 	m|monitor)
@@ -368,7 +371,7 @@ case "$getopt" in
 	r|restart)
 	r|restart)
 		fn_restart;;
 		fn_restart;;
 	uf|update-functions)
 	uf|update-functions)
-		update_functions.sh;;
+		command_update_functions.sh;;
 	m|monitor)
 	m|monitor)
 		command_monitor.sh;;
 		command_monitor.sh;;
 	et|email-test)
 	et|email-test)
@@ -385,6 +388,10 @@ case "$getopt" in
 		command_dev_debug.sh;;		
 		command_dev_debug.sh;;		
 	i|install)
 	i|install)
 		command_install.sh;;
 		command_install.sh;;
+	ai|auto-install)
+		fn_autoinstall;;
+	sck|server-cd-key)
+		install_ut2k4_key.sh;;				
 	mc|map-compressor)
 	mc|map-compressor)
 		compress_unreal2_maps.sh;;
 		compress_unreal2_maps.sh;;
 	dd|depsdetect)
 	dd|depsdetect)
@@ -407,6 +414,8 @@ case "$getopt" in
 		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
 		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
 		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
 		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
 		echo -e "\e[34minstall\t\e[0mInstall the server."
 		echo -e "\e[34minstall\t\e[0mInstall the server."
+		echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
+		echo -e "\e[34mserver-cd-key\t\e[0mAdd your server cd key"		
 		echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
 		echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
 	} | column -s $'\t' -t 
 	} | column -s $'\t' -t 
 	esac
 	esac

+ 82 - 35
functions/core_messages.sh

@@ -2,11 +2,15 @@
 # LGSM fn_messages function
 # LGSM fn_messages function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="380216"
 
 
 # Description: Defines on-screen messages such as [  OK  ] and how script logs look.
 # Description: Defines on-screen messages such as [  OK  ] and how script logs look.
 
 
-# Date and servicename for log files.
+# nl: new line: message is following by a new line
+# eol: end of line: message is placed at the end of the current line
+
+# Date, servicename & module details displayed in log files.
+# e.g Feb 28 14:56:58 ut99-server: Monitor:
 fn_scriptlog(){
 fn_scriptlog(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
 		echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}"
 		echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${modulename}: ${1}" >> "${scriptlog}"
@@ -16,7 +20,7 @@ fn_scriptlog(){
 }
 }
 
 
 # [ FAIL ]
 # [ FAIL ]
-fn_printfail(){
+fn_print_fail(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
 		echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
 		echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
@@ -24,16 +28,18 @@ fn_printfail(){
 	fi
 	fi
 }
 }
 
 
-fn_printfailnl(){
+fn_print_fail_nl(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
-		echo -e "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
+		echo -en "\r\033[K[\e[0;31m FAIL \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
-		echo -e "\r\033[K[\e[0;31m FAIL \e[0m] $@"
+		echo -en "\r\033[K[\e[0;31m FAIL \e[0m] $@"
 	fi
 	fi
+	sleep 1
+	echo -en "\n"		
 }
 }
 	
 	
 # [  OK  ]
 # [  OK  ]
-fn_printok(){
+fn_print_ok(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
 		echo -en "\r\033[K[\e[0;32m  OK  \e[0m] ${modulename} ${servicename}: $@"
 		echo -en "\r\033[K[\e[0;32m  OK  \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
@@ -41,16 +47,18 @@ fn_printok(){
 	fi
 	fi
 }
 }
 
 
-fn_printoknl(){
+fn_print_ok_nl(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
-		echo -e "\r\033[K[\e[0;32m  OK  \e[0m] ${modulename} ${servicename}: $@"
+		echo -en "\r\033[K[\e[0;32m  OK  \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
-		echo -e "\r\033[K[\e[0;32m  OK  \e[0m] $@"
+		echo -en "\r\033[K[\e[0;32m  OK  \e[0m] $@"
 	fi
 	fi
+	sleep 1
+	echo -en "\n"	
 }
 }
 
 
 # [ INFO ]
 # [ INFO ]
-fn_printinfo(){
+fn_print_info(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
 		echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
 		echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
@@ -58,16 +66,18 @@ fn_printinfo(){
 	fi
 	fi
 }
 }
 
 
-fn_printinfonl(){
+fn_print_info_nl(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
-		echo -e "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
+		echo -en "\r\033[K[\e[0;36m INFO \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
-		echo -e "\r\033[K[\e[0;36m INFO \e[0m] $@"
+		echo -en "\r\033[K[\e[0;36m INFO \e[0m] $@"
 	fi
 	fi
+	sleep 1
+	echo -en "\n"		
 }
 }
 
 
 # [ WARN ]
 # [ WARN ]
-fn_printwarn(){
+fn_print_warn(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
 		echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
 		echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
@@ -75,16 +85,18 @@ fn_printwarn(){
 	fi
 	fi
 }
 }
 
 
-fn_printwarnnl(){
+fn_print_warn_nl(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
-		echo -e "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
+		echo -en "\r\033[K[\e[1;33m WARN \e[0m] ${modulename} ${servicename}: $@"
 	else
 	else
-		echo -e "\r\033[K[\e[1;33m WARN \e[0m] $@"
+		echo -en "\r\033[K[\e[1;33m WARN \e[0m] $@"
 	fi
 	fi
+	sleep 1
+	echo -en "\n"		
 }
 }
 
 
 # [ .... ]
 # [ .... ]
-fn_printdots(){
+fn_print_dots(){
 	if [ -n "${modulename}" ]; then
 	if [ -n "${modulename}" ]; then
 		echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@"
 		echo -en "\r\033[K[ .... ] ${modulename} ${servicename}: $@"
 	else
 	else
@@ -93,56 +105,91 @@ fn_printdots(){
 }
 }
 
 
 # Complete!
 # Complete!
-fn_printcomplete(){
+fn_print_complete(){
 	echo -en "\e[0;32mComplete!\e[0m $@"
 	echo -en "\e[0;32mComplete!\e[0m $@"
 }
 }
 
 
-fn_printcompletenl(){
+fn_print_complete_nl(){
 	echo -e "\e[0;32mComplete!\e[0m $@"
 	echo -e "\e[0;32mComplete!\e[0m $@"
 }
 }
 
 
 # Warning!
 # Warning!
-fn_printwarning(){
+fn_print_warning(){
 	echo -en "\e[0;33mWarning!\e[0m $@"
 	echo -en "\e[0;33mWarning!\e[0m $@"
 }
 }
 
 
-fn_printwarningnl(){
+fn_print_warning_nl(){
 	echo -e "\e[0;33mWarning!\e[0m $@"
 	echo -e "\e[0;33mWarning!\e[0m $@"
 }
 }
 
 
 # Failure!
 # Failure!
-fn_printfailure(){
+fn_print_failure(){
 	echo -en "\e[0;31mFailure!\e[0m $@"
 	echo -en "\e[0;31mFailure!\e[0m $@"
 }
 }
 
 
-fn_printfailurenl(){
+fn_print_failure_nl(){
 	echo -e "\e[0;31mFailure!\e[0m $@"
 	echo -e "\e[0;31mFailure!\e[0m $@"
 }
 }
 
 
 # Error!
 # Error!
-fn_printerror(){
+fn_print_error(){
 	echo -en "\e[0;31mError!\e[0m $@"
 	echo -en "\e[0;31mError!\e[0m $@"
 }
 }
 
 
-fn_printerrornl(){
+fn_print_error_nl(){
 	echo -e "\e[0;31mError!\e[0m $@"
 	echo -e "\e[0;31mError!\e[0m $@"
 }
 }
 
 
-# Info!
-fn_printinfomation(){
-	echo -en "\e[0;36mInfo!\e[0m $@"
+# Infomation!
+fn_print_infomation(){
+	echo -en "\e[0;36mInfomation!\e[0m $@"
 }
 }
 
 
-fn_printinfomationnl(){
-	echo -e "\e[0;36mInfo!\e[0m $@"
+fn_print_infomation_nl(){
+	echo -e "\e[0;36mInfomation!\e[0m $@"
 }
 }
 
 
 # FAIL for end of line
 # FAIL for end of line
-fn_printokeol(){
+fn_print_ok_eol(){
+	echo -en "\e[0;32mOK\e[0m"
+}
+
+fn_print_ok_eol_nl(){
 	echo -e "\e[0;32mOK\e[0m"
 	echo -e "\e[0;32mOK\e[0m"
 }
 }
 
 
 # FAIL for end of line
 # FAIL for end of line
-fn_printfaileol(){
-	echo -e "\e[0;31mFAIL\e[0m\n"
+fn_print_fail_eol(){
+	echo -en "\e[0;31mFAIL\e[0m"
+}
+
+fn_print_fail_eol_nl(){
+	echo -e "\e[0;31mFAIL\e[0m"
+}
+
+# QUERYING for end of line
+fn_print_querying_eol(){
+	echo -en "\e[0;36mQUERYING\e[0m"
+}
+
+fn_print_querying_eol_nl(){
+	echo -e "\e[0;36mQUERYING\e[0m"
+}
+
+# CANCELED for end of line
+fn_print_canceled_eol(){
+	echo -en "\e[0;33mCANCELED\e[0m"
+}
+
+fn_print_canceled_eol_nl(){
+	echo -e "\e[0;33mCANCELED\e[0m"
+}
+
+# REMOVED for end of line
+fn_print_removed_eol(){
+	echo -en "\e[0;31mREMOVED\e[0m"
+}
+
+fn_print_removed_eol_nl(){
+	echo -e "\e[0;31mREMOVED\e[0m"
 }
 }

+ 5 - 7
functions/email.sh

@@ -7,7 +7,7 @@ lgsm_version="020216"
 # Description: Sends email notification if monitor picks up a failure.
 # Description: Sends email notification if monitor picks up a failure.
 
 
 local modulename="Email"
 local modulename="Email"
-fn_printdots "Sending notification to ${email}"
+fn_print_dots "Sending notification to ${email}"
 info_distro.sh
 info_distro.sh
 info_config.sh
 info_config.sh
 check_ip.sh
 check_ip.sh
@@ -55,16 +55,14 @@ fn_parms
 }| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee "${scriptlogdir}/${servicename}-email.log" > /dev/null 2>&1
 }| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee "${scriptlogdir}/${servicename}-email.log" > /dev/null 2>&1
 echo -e "\n\n	Script log\n===================" >> "${emaillog}"
 echo -e "\n\n	Script log\n===================" >> "${emaillog}"
 tail -25 "${scriptlog}" >> "${emaillog}"
 tail -25 "${scriptlog}" >> "${emaillog}"
-if [ ! -z "${consolelog}" ]; then
+if [ -n "${consolelog}" ]; then
 	echo -e "\n\n	Console log\n====================" >> "${emaillog}"
 	echo -e "\n\n	Console log\n====================" >> "${emaillog}"
 	tail -25 "${consolelog}" | awk '{ sub("\r$", ""); print }' >> "${emaillog}"
 	tail -25 "${consolelog}" | awk '{ sub("\r$", ""); print }' >> "${emaillog}"
 fi
 fi
-if [ ! -z "${gamelogdir}" ]; then
+if [ -n "${gamelogdir}" ]; then
 	echo -e "\n\n	Server log\n====================" >> "${emaillog}"
 	echo -e "\n\n	Server log\n====================" >> "${emaillog}"
 	tail "${gamelogdir}"/* | grep -v "==>" | sed '/^$/d' | tail -25 >> "${emaillog}"
 	tail "${gamelogdir}"/* | grep -v "==>" | sed '/^$/d' | tail -25 >> "${emaillog}"
 fi
 fi
 mail -s "${subject}" ${email} < "${emaillog}"
 mail -s "${subject}" ${email} < "${emaillog}"
-fn_printok "Sending notification to ${email}"
-fn_scriptlog "Sent notification to ${email}"
-sleep 1
-echo -en "\n"
+fn_print_ok_nl "Sending notification to ${email}"
+fn_scriptlog "Sent notification to ${email}"

+ 22 - 3
functions/fix.sh

@@ -2,19 +2,38 @@
 # LGSM fix.sh function
 # LGSM fix.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="020116"
+lgsm_version="010316"
 
 
 # Description: Overall function for managing fixes.
 # Description: Overall function for managing fixes.
 # Runs functions that will fix an issue.
 # Runs functions that will fix an issue.
 
 
+# Messages that are displayed for some fixes
+fn_fix_msg_start(){
+	fn_print_dots "Applying ${fixname} fix: ${gamename}"
+	sleep 1
+	fn_print_info "Applying ${fixname} fix: ${gamename}"
+	fn_scriptlog "Applying ${fixname} fix: ${gamename}"
+	sleep 1
+}
+
+fn_fix_msg_end(){
+	if [ $? -ne 0 ]; then
+		fn_print_fail_nl "Applying ${fixname} fix: ${gamename}"
+		fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
+	else
+		fn_print_ok_nl "Applying ${fixname} fix: ${gamename}"
+		fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
+	fi	
+}
+
+
 # Fixes that are run on start
 # Fixes that are run on start
 if [ "${function_selfname}" != "command_install.sh" ]; then
 if [ "${function_selfname}" != "command_install.sh" ]; then
-	if [ ! -z "${appid}" ]; then
+	if [ -n "${appid}" ]; then
 		fix_steamcmd.sh
 		fix_steamcmd.sh
 	fi	
 	fi	
 
 
 	if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
 	if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
-		startfix=1
 		fix_csgo.sh
 		fix_csgo.sh
 	elif [ "${gamename}" == "Don't Starve Together" ]; then
 	elif [ "${gamename}" == "Don't Starve Together" ]; then
 		fix_dst.sh		
 		fix_dst.sh		

+ 3 - 23
functions/fix_arma3.sh

@@ -4,30 +4,10 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="301215"
 lgsm_version="301215"
 
 
-# Fixes line 63: 20150 Segmentation fault (core dumped) #488
-
-fn_msg_start(){
-	fn_printdots "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-	fn_printinfo "Applying ${fixname} fix: ${gamename}"
-	fn_scriptlog "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-}
-
-fn_msg_end(){
-	if [ $? -ne 0 ]; then
-		fn_printfailnl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
-	else
-		fn_printoknl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
-	fi	
-}
-
 # Fixes: server not always creating steam_appid.txt file.
 # Fixes: server not always creating steam_appid.txt file.
 if [ ! -d "${rootdir}/.local/share/Arma\ 3" ]; then
 if [ ! -d "${rootdir}/.local/share/Arma\ 3" ]; then
-	local fixname="20150 Segmentation fault (core dumped)"
-	fn_msg_start
+	fixname="20150 Segmentation fault (core dumped)"
+	fn_fix_msg_start
 	mkdir -p "${rootdir}/.local/share/Arma\ 3"
 	mkdir -p "${rootdir}/.local/share/Arma\ 3"
-	fn_msg_end
+	fn_fix_msg_end
 fi
 fi

+ 13 - 31
functions/fix_csgo.sh

@@ -2,60 +2,42 @@
 # LGSM fix_csgo.sh function
 # LGSM fix_csgo.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="301215"
+lgsm_version="010316"
 
 
 # Description: Resolves various issues with csgo.
 # Description: Resolves various issues with csgo.
 
 
-fn_msg_start(){
-	fn_printdots "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-	fn_printinfo "Applying ${fixname} fix: ${gamename}"
-	fn_scriptlog "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-}
-
-fn_msg_end(){
-	if [ $? -ne 0 ]; then
-		fn_printfailnl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
-	else
-		fn_printoknl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
-	fi	
-}
-
 # Fixes: server not always creating steam_appid.txt file.
 # Fixes: server not always creating steam_appid.txt file.
 if [ ! -f "${filesdir}/steam_appid.txt" ]; then
 if [ ! -f "${filesdir}/steam_appid.txt" ]; then
-	local fixname="730 steam_appid.txt"
-	fn_msg_start
+	fixname="730 steam_appid.txt"
+	fn_fix_msg_start
 	echo -n "730" >> "${filesdir}/steam_appid.txt"
 	echo -n "730" >> "${filesdir}/steam_appid.txt"
-	fn_msg_end
+	fn_fix_msg_end
 fi
 fi
 
 
 # Fixes: Error parsing BotProfile.db - unknown attribute 'Rank'".
 # Fixes: Error parsing BotProfile.db - unknown attribute 'Rank'".
 if ! grep -q "//Rank" "${systemdir}/botprofile.db" > /dev/null 2>&1; then
 if ! grep -q "//Rank" "${systemdir}/botprofile.db" > /dev/null 2>&1; then
-	local fixname="botprofile.db"
-	fn_msg_start
+	fixname="botprofile.db"
+	fn_fix_msg_start
 	sed -i 's/\tRank/\t\/\/Rank/g' "${systemdir}/botprofile.db" > /dev/null 2>&1
 	sed -i 's/\tRank/\t\/\/Rank/g' "${systemdir}/botprofile.db" > /dev/null 2>&1
-	fn_msg_end
+	fn_fix_msg_end
 fi
 fi
 
 
 # Fixes: Unknown command "cl_bobamt_vert".
 # Fixes: Unknown command "cl_bobamt_vert".
 if ! grep -q "//exec default" "${servercfgdir}/valve.rc" > /dev/null 2>&1 || ! grep -q "//exec joystick" "${servercfgdir}/valve.rc" > /dev/null 2>&1; then
 if ! grep -q "//exec default" "${servercfgdir}/valve.rc" > /dev/null 2>&1 || ! grep -q "//exec joystick" "${servercfgdir}/valve.rc" > /dev/null 2>&1; then
-	local fixname="valve.rc"
-	fn_msg_start
+	fixname="valve.rc"
+	fn_fix_msg_start
 	sed -i 's/exec default.cfg/\/\/exec default.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
 	sed -i 's/exec default.cfg/\/\/exec default.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
 	sed -i 's/exec joystick.cfg/\/\/exec joystick.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
 	sed -i 's/exec joystick.cfg/\/\/exec joystick.cfg/g' "${servercfgdir}/valve.rc" > /dev/null 2>&1
-	fn_msg_end
+	fn_fix_msg_end
 fi
 fi
 
 
 # Fixes: workshop map issue.
 # Fixes: workshop map issue.
 # http://forums.steampowered.com/forums/showthread.php?t=3170366.
 # http://forums.steampowered.com/forums/showthread.php?t=3170366.
 if [ -f "${systemdir}/subscribed_collection_ids.txt" ]||[ -f "${systemdir}/subscribed_file_ids.txt" ]||[ -f "${systemdir}/ugc_collection_cache.txt" ]; then
 if [ -f "${systemdir}/subscribed_collection_ids.txt" ]||[ -f "${systemdir}/subscribed_file_ids.txt" ]||[ -f "${systemdir}/ugc_collection_cache.txt" ]; then
-	local fixname="workshop map"
-	fn_msg_start
+	fixname="workshop map"
+	fn_fix_msg_start
 	rm -f "${systemdir}/subscribed_collection_ids.txt"
 	rm -f "${systemdir}/subscribed_collection_ids.txt"
 	rm -f "${systemdir}/subscribed_file_ids.txt"
 	rm -f "${systemdir}/subscribed_file_ids.txt"
 	rm -f "${systemdir}/ugc_collection_cache.txt"
 	rm -f "${systemdir}/ugc_collection_cache.txt"
-	fn_msg_end
+	fn_fix_msg_end
 fi
 fi

+ 5 - 23
functions/fix_dst.sh

@@ -2,33 +2,15 @@
 # LGSM fix_dst.sh function
 # LGSM fix_dst.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="020116"
+lgsm_version="010316"
 
 
-# Fixes line 63: 20150 Segmentation fault (core dumped) #488
-
-fn_msg_start(){
-	fn_printdots "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-	fn_printinfo "Applying ${fixname} fix: ${gamename}"
-	fn_scriptlog "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-}
-
-fn_msg_end(){
-	if [ $? -ne 0 ]; then
-		fn_printfailnl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
-	else
-		fn_printoknl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
-	fi	
-}
+# Description: Resolves various issues with Dont Starve together.
 
 
 # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer)
 # Fixes: ./dontstarve_dedicated_server_nullrenderer: ./lib32/libcurl-gnutls.so.4: no version information available (required by ./dontstarve_dedicated_server_nullrenderer)
 # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
 # Issue only occures on CentOS as libcurl-gnutls.so.4 is called libcurl.so.4 on CentOS.
 if [ -f "/etc/redhat-release" ] && [ ! -f "${filesdir}/bin/lib32/libcurl-gnutls.so.4" ]; then
 if [ -f "/etc/redhat-release" ] && [ ! -f "${filesdir}/bin/lib32/libcurl-gnutls.so.4" ]; then
-	local fixname="libcurl-gnutls.so.4 missing"
-	fn_msg_start
+	fixname="libcurl-gnutls.so.4 missing"
+	fn_fix_msg_start
 	ln -s "/usr/lib/libcurl.so.4" "${filesdir}/bin/lib32/libcurl-gnutls.so.4"
 	ln -s "/usr/lib/libcurl.so.4" "${filesdir}/bin/lib32/libcurl-gnutls.so.4"
-	fn_msg_end
+	fn_fix_msg_end
 fi
 fi

+ 3 - 3
functions/fix_glibc.sh

@@ -9,7 +9,7 @@ echo ""
 echo "GLIBC Fix required"
 echo "GLIBC Fix required"
 echo "============================"
 echo "============================"
 sleep 1
 sleep 1
-fn_printwarningnl "${gamename} requires GLIBC_${glibcversion} or above"
+fn_print_warning_nl "${gamename} requires GLIBC_${glibcversion} or above"
 sleep 1
 sleep 1
 echo ""
 echo ""
 echo -e "Currently installed:\e[0;31m GLIBC_$(ldd --version |grep ldd|awk '{print $NF}')\e[0;39m"
 echo -e "Currently installed:\e[0;31m GLIBC_$(ldd --version |grep ldd|awk '{print $NF}')\e[0;39m"
@@ -34,7 +34,7 @@ echo -en "\n"
 # if ldd command not detected
 # if ldd command not detected
 if [ -z $(command -v ldd) ]; then
 if [ -z $(command -v ldd) ]; then
 	echo ""
 	echo ""
-	fn_printfailurenl "GLIBC is not detected"
+	fn_print_failure_nl "GLIBC is not detected"
 	sleep 1
 	sleep 1
 	echo "Install GLIBC and retry installation."
 	echo "Install GLIBC and retry installation."
 	sleep 1
 	sleep 1
@@ -93,7 +93,7 @@ elif [ "$(ldd --version | sed -n '1 p' | tr -cd '[:digit:]' | tail -c 3)" -lt 21
 		wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/librt.so.1
 		wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/librt.so.1
 		wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/libpthread.so.0
 		wget -nv -N https://github.com/dgibbs64/linuxgsm/raw/master/Insurgency/dependencies/libpthread.so.0
 	elif [ "${gamename}" == "Left 4 Dead" ]; then
 	elif [ "${gamename}" == "Left 4 Dead" ]; then
-		glibcversion="2.07"
+		glibcversion="2.3.6"
 		fn_glibcfixmsg
 		fn_glibcfixmsg
 		cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/bin/libstdc++.so.6"
 		cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/bin/libstdc++.so.6"
 	# Natural Selection 2
 	# Natural Selection 2

+ 3 - 1
functions/fix_ro.sh

@@ -2,7 +2,9 @@
 # LGSM fix_ro.sh function
 # LGSM fix_ro.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="010316"
+
+# Description: Resolves various issues with red orchestra.
 
 
 echo "Applying WebAdmin ROOst.css fix."
 echo "Applying WebAdmin ROOst.css fix."
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 13 - 33
functions/fix_steamcmd.sh

@@ -2,60 +2,40 @@
 # LGSM fix_steamcmd.sh function
 # LGSM fix_steamcmd.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="010116"
+lgsm_version="010316"
 
 
 # Description: fixes various issues related to steamCMD.
 # Description: fixes various issues related to steamCMD.
 
 
-fn_msg_start(){
-	fn_printdots "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-	fn_printinfo "Applying ${fixname} fix: ${gamename}"
-	fn_scriptlog "Applying ${fixname} fix: ${gamename}"
-	sleep 1
-}
-
-fn_msg_end(){
-	if [ $? -ne 0 ]; then
-		fn_printfailnl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Failure! Applying ${fixname} fix: ${gamename}"
-	else
-		fn_printoknl "Applying ${fixname} fix: ${gamename}"
-		fn_scriptlog "Complete! Applying ${fixname} fix: ${gamename}"
-	fi	
-}
-
-
 # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
 # Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam,or a local steamclient.so.
 if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
 if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
-	local fixname="steamclient.so general"
-	fn_msg_start
+	fixname="steamclient.so general"
+	fn_fix_msg_start
 	mkdir -pv "${HOME}/.steam/sdk32" >> "${scriptlog}"
 	mkdir -pv "${HOME}/.steam/sdk32" >> "${scriptlog}"
 	cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${scriptlog}"
 	cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${scriptlog}"
-	fn_msg_end
+	fn_fix_msg_end
 fi
 fi
 
 
 if [ "${gamename}" == "Serious Sam 3: BFE" ]; then
 if [ "${gamename}" == "Serious Sam 3: BFE" ]; then
 	# Fixes: .steam/bin32/libsteam.so: cannot open shared object file: No such file or directory
 	# Fixes: .steam/bin32/libsteam.so: cannot open shared object file: No such file or directory
 	if [ ! -f "${HOME}/.steam/bin32/libsteam.so" ]; then
 	if [ ! -f "${HOME}/.steam/bin32/libsteam.so" ]; then
-		local fixname="libsteam.so"
-		fn_msg_start
+		fixname="libsteam.so"
+		fn_fix_msg_start
 		mkdir -pv "${HOME}/.steam/bin32" >> "${scriptlog}"
 		mkdir -pv "${HOME}/.steam/bin32" >> "${scriptlog}"
 		cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${scriptlog}"
 		cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" >> "${scriptlog}"
-		fn_msg_end
+		fn_fix_msg_end
 	fi
 	fi
 elif [ "${gamename}" == "Hurtworld" ]; then
 elif [ "${gamename}" == "Hurtworld" ]; then
 	# Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
 	# Fixes: [S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
-
 	if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then
 	if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" ]; then
-		local fixname="steamclient.so x86"
-		fn_msg_start
+		fixname="steamclient.so x86"
+		fn_fix_msg_start
 		cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}"
 		cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${scriptlog}"
-		fn_msg_end
+		fn_fix_msg_end
 	fi	
 	fi	
 	if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then
 	if [ ! -f "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" ]; then
-		local fixname="steamclient.so x86_64"
-		fn_msg_start	
+		fixname="steamclient.so x86_64"
+		fn_fix_msg_start	
 		cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}"
 		cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${scriptlog}"
-		fn_msg_end
+		fn_fix_msg_end
 	fi
 	fi
 fi
 fi

+ 7 - 10
functions/fix_ut2k4.sh

@@ -2,7 +2,9 @@
 # LGSM fix_ut2k4.sh function
 # LGSM fix_ut2k4.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="010316"
+
+# Description: Resolves various issues with unreal tournament 2004.
 
 
 echo "applying WebAdmin ut2003.css fix."
 echo "applying WebAdmin ut2003.css fix."
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
 echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
@@ -13,15 +15,10 @@ echo "applying WebAdmin CharSet fix."
 echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
 echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
 sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int"
 sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int"
 sleep 1
 sleep 1
-echo ""
-echo -en "forcing server restart.\r"
-sleep 0.5
-echo -en "forcing server restart..\r"
-sleep 0.5
-echo -en "forcing server restart...\r"
-sleep 0.5
-echo -en "\n"
-sleep 0.5
+echo "applying server name fix."
+sleep 1
+echo "forcing server restart..."
+sleep 1
 command_start.sh
 command_start.sh
 sleep 5
 sleep 5
 command_stop.sh
 command_stop.sh

+ 3 - 3
functions/fix_ut99.sh

@@ -3,7 +3,7 @@
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
-
+echo "${servercfgfullpath}"
 echo "enabling UdpServerUplink."
 echo "enabling UdpServerUplink."
 {
 {
 echo "[IpServer.UdpServerUplink]"
 echo "[IpServer.UdpServerUplink]"
@@ -12,7 +12,7 @@ echo "UpdateMinutes=1"
 echo "MasterServerAddress=unreal.epicgames.com"
 echo "MasterServerAddress=unreal.epicgames.com"
 echo "MasterServerPort=27900"
 echo "MasterServerPort=27900"
 echo "Region=0"
 echo "Region=0"
-}|tee -a "${servercfgfullpath}" > /dev/null 2>&1
+}| tee -a "${servercfgfullpath}" > /dev/null 2>&1
 sleep 1
 sleep 1
 echo "removing dead gamespy.com master server."
 echo "removing dead gamespy.com master server."
 sed -i '/master0.gamespy.com/d' "${servercfgfullpath}"
 sed -i '/master0.gamespy.com/d' "${servercfgfullpath}"
@@ -21,5 +21,5 @@ echo "removing dead mplayer.com master server."
 sed -i '/master.mplayer.com/d' "${servercfgfullpath}"
 sed -i '/master.mplayer.com/d' "${servercfgfullpath}"
 sleep 1
 sleep 1
 echo "inserting qtracker.com master server."
 echo "inserting qtracker.com master server."
-sed -i '66i\ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.qtracker.com MasterServerPort=27900' "${servercfgfullpath}"
+sed -i '65i\ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.qtracker.com MasterServerPort=27900' "${servercfgfullpath}"
 echo ""
 echo ""

+ 4 - 4
functions/fn_update_functions

@@ -1,22 +1,22 @@
 #!/bin/bash
 #!/bin/bash
-# LGSM update_functions.sh function
+# LGSM fn_update_functions.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="230116"
 lgsm_version="230116"
 
 
 # Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub.
 # Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub.
 
 
-fn_printdots "Updating functions"
+fn_print_dots "Updating functions"
 fn_scriptlog "Updating functions"
 fn_scriptlog "Updating functions"
 sleep 1
 sleep 1
 echo -ne "\n"
 echo -ne "\n"
 rm -rfv "${rootdir}/functions/"*
 rm -rfv "${rootdir}/functions/"*
 exitcode=$?
 exitcode=$?
 if [ "${exitcode}" == "0" ]; then
 if [ "${exitcode}" == "0" ]; then
-	fn_printok "Updating functions"
+	fn_print_ok "Updating functions"
 	fn_scriptlog "Success! Updating functions"
 	fn_scriptlog "Success! Updating functions"
 else
 else
-	fn_printfail "Updating functions"
+	fn_print_fail "Updating functions"
 	fn_scriptlog "Failure! Updating functions"
 	fn_scriptlog "Failure! Updating functions"
 fi
 fi
 echo -ne "\n"
 echo -ne "\n"

+ 0 - 0
GameServerQuery/gsquery.py → functions/gsquery.py


+ 25 - 25
functions/info_config.sh

@@ -2,7 +2,7 @@
 # LGSM info_config.sh function
 # LGSM info_config.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="190216"
+lgsm_version="010316"
 
 
 # Description: Gets specific details from config files.
 # Description: Gets specific details from config files.
 
 
@@ -258,29 +258,29 @@ elif [ "${engine}" == "realvirtuality" ]; then
 		slots="\e[0;31mUNAVAILABLE\e[0m"
 		slots="\e[0;31mUNAVAILABLE\e[0m"
 	fi
 	fi
 
 
-        # port
-        if [ "${port}" != "" ]; then
-                        port=${port}
-        fi
-        if [ ! -n "${port}" ]; then
-                port="0"
-        fi
-
-        # query port
-        if [ "${port}" != "" ]; then
-                queryport=$((port+1))
-        fi
-        if [ ! -n "${queryport}" ]; then
-                queryport="0"
-        fi
-
-        # master port
-        if [ "${port}" != "" ]; then
-                masterport=$((port+2))
-        fi
-        if [ ! -n "${masterport}" ]; then
-                masterport="0"
-        fi
+    # port
+    if [ "${port}" != "" ]; then
+		port=${port}
+    fi
+    if [ ! -n "${port}" ]; then
+		port="0"
+    fi
+
+    # query port
+    if [ "${port}" != "" ]; then
+		queryport=$((port + 1))
+    fi
+    if [ ! -n "${queryport}" ]; then
+		queryport="0"
+    fi
+
+    # master port
+    if [ "${port}" != "" ]; then
+		masterport=$((port + 2))
+    fi
+    if [ ! -n "${masterport}" ]; then
+		masterport="0"
+    fi
 
 
 # Serious Sam
 # Serious Sam
 elif [ "${engine}" == "seriousengine35" ]; then
 elif [ "${engine}" == "seriousengine35" ]; then
@@ -335,7 +335,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
 
 
 	# query port
 	# query port
 	if [ -f "${servercfgfullpath}" ]; then
 	if [ -f "${servercfgfullpath}" ]; then
-		queryport=$((${port} + 1))
+		queryport=$((port + 1))
 	fi
 	fi
 	if [ ! -n "${queryport}" ]; then
 	if [ ! -n "${queryport}" ]; then
 		queryport="0"
 		queryport="0"

+ 8 - 3
functions/info_glibc.sh

@@ -2,11 +2,10 @@
 # LGSM info_glibc.sh function
 # LGSM info_glibc.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="190216"
+lgsm_version="260216"
 
 
 # Description: stores details on servers Glibc requirements.
 # Description: stores details on servers Glibc requirements.
 
 
-
 if [ "${gamename}" == "Blade Symphony" ]; then
 if [ "${gamename}" == "Blade Symphony" ]; then
 	glibcrequired="2.15"
 	glibcrequired="2.15"
 	glibcfix="yes"
 	glibcfix="yes"
@@ -46,7 +45,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
 	glibcrequired="2.13"
 	glibcrequired="2.13"
 	glibcfix="yes"
 	glibcfix="yes"
 elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
 elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
-	glibcrequired="2.07"
+	glibcrequired="2.3.6"
 	glibcfix="no"
 	glibcfix="no"
 elif [ "${engine}" == "spark" ]; then
 elif [ "${engine}" == "spark" ]; then
 	glibcrequired="2.15"
 	glibcrequired="2.15"
@@ -54,6 +53,12 @@ elif [ "${engine}" == "spark" ]; then
 elif [ "${engine}" == "starbound" ]; then
 elif [ "${engine}" == "starbound" ]; then
 	glibcrequired="2.12"
 	glibcrequired="2.12"
 	glibcfix="no"
 	glibcfix="no"
+elif [ "${engine}" == "unreal" ]; then
+	glibcrequired="2.1"
+	glibcfix="no"	
+elif [ "${engine}" == "unreal2" ]; then
+	glibcrequired="2.4"
+	glibcfix="no"
 elif [ "${engine}" == "unreal4" ]; then
 elif [ "${engine}" == "unreal4" ]; then
 	glibcrequired="2.14"
 	glibcrequired="2.14"
 	glibcfix="no"
 	glibcfix="no"

+ 3 - 0
functions/install_complete.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
+local modulename="Install"
+
 if [ "${gamename}" == "Don't Starve Together" ]; then
 if [ "${gamename}" == "Don't Starve Together" ]; then
   echo ""
   echo ""
   echo "An Authentication Token is required to run this server!"
   echo "An Authentication Token is required to run this server!"
@@ -12,6 +14,7 @@ if [ "${gamename}" == "Don't Starve Together" ]; then
 fi
 fi
 echo "================================="
 echo "================================="
 echo "Install Complete!"
 echo "Install Complete!"
+fn_scriptlog "Install Complete!"
 echo ""
 echo ""
 echo "To start server type:"
 echo "To start server type:"
 echo "./${selfname} start"
 echo "./${selfname} start"

+ 3 - 1
functions/install_config.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="220216"
 lgsm_version="220216"
 
 
+local modulename="Install"
+
 fn_defaultconfig(){
 fn_defaultconfig(){
 	echo "creating ${servercfg} config file."
 	echo "creating ${servercfg} config file."
 	cp -v "${servercfgdefault}" "${servercfgfullpath}"
 	cp -v "${servercfgdefault}" "${servercfgfullpath}"
@@ -103,7 +105,7 @@ echo ""
 }
 }
 
 
 fn_ut99config(){
 fn_ut99config(){
-echo "${defaultcfg} > ${servercfgfullpath}"
+echo "${servercfgdefault} > ${servercfgfullpath}"
 tr -d '\r' < "${servercfgdefault}" > "${servercfgfullpath}"
 tr -d '\r' < "${servercfgdefault}" > "${servercfgfullpath}"
 sleep 1
 sleep 1
 echo ""
 echo ""

+ 0 - 54
functions/install_dl_ut2k4.sh

@@ -1,54 +0,0 @@
-#!/bin/bash
-# LGSM install_dl_ut2k4.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Downloading Server Files"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-if [ ! -f dedicatedserver3339-bonuspack.zip ]; then
-	wget http://gameservermanagers.com/files/ut2004/dedicatedserver3339-bonuspack.zip
-else
-	echo "dedicatedserver3339-bonuspack.zip already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: d3f28c5245c4c02802d48e4f0ffd3e34"
-md5check=$(md5sum dedicatedserver3339-bonuspack.zip|awk '{print $1;}')
-echo "File returned: ${md5check}"
-if [ "${md5check}" != "d3f28c5245c4c02802d48e4f0ffd3e34" ]; then
-	echo "MD5 checksum: FAILED!"
-	read -p "Retry download? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; install_dl_ut2k4.sh;;
-	[Nn]* ) echo Exiting; exit;;
-	* ) echo "Please answer yes or no.";;
-	esac
-else
-	echo "MD5 checksum: PASSED"
-fi
-if [ ! -f ut2004-lnxpatch3369-2.tar.bz2 ]; then
-	wget http://gameservermanagers.com/files/ut2004/ut2004-lnxpatch3369-2.tar.bz2
-else
-	echo "ut2004-lnxpatch3369-2.tar.bz2 already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: 0fa447e05fe5a38e0e32adf171be405e"
-md5check=$(md5sum ut2004-lnxpatch3369-2.tar.bz2|awk '{print $1;}')
-echo "File returned: ${md5check}"
-if [ "${md5check}" != "0fa447e05fe5a38e0e32adf171be405e" ]; then
-	echo "MD5 checksum: FAILED!"
-	read -p "Retry download? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; install_dl_ut2k4.sh;;
-	[Nn]* ) echo Exiting; exit;;
-	* ) echo "Please answer yes or no.";;
-	esac
-else
-	echo "MD5 checksum: PASSED"
-fi
-echo ""

+ 0 - 54
functions/install_dl_ut99.sh

@@ -1,54 +0,0 @@
-#!/bin/bash
-# LGSM install_dl_ut99.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Downloading Server Files"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-if [ ! -f ut-server-436.tar.gz ]; then
-	wget http://gameservermanagers.com/files/ut99/ut-server-436.tar.gz
-else
-	echo "ut-server-436.tar.gz already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: 10cd7353aa9d758a075c600a6dd193fd"
-md5check=$(md5sum ut-server-436.tar.gz|awk '{print $1;}')
-echo "File returned: ${md5check}"
-if [ "${md5check}" != "10cd7353aa9d758a075c600a6dd193fd" ]; then
-	echo "MD5 checksum: FAILED!"
-	read -p "Retry download? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv ut-server-436.tar.gz; fn_filesdl;;
-	[Nn]* ) echo Exiting; exit;;
-	* ) echo "Please answer yes or no.";;
-	esac
-else
-	echo "MD5 checksum: PASSED"
-fi
-if [ ! -f UTPGPatch451.tar.bz2 ]; then
-	wget http://gameservermanagers.com/files/ut99/UTPGPatch451.tar.bz2
-else
-	echo "UTPGPatch451.tar.bz2 already downloaded!"
-fi
-echo "Running MD5 checksum to verify the file"
-sleep 1
-echo "MD5 checksum: 77a735a78b1eb819042338859900b83b"
-md5check=$(md5sum UTPGPatch451.tar.bz2|awk '{print $1;}')
-echo "File returned: ${md5check}"
-if [ "${md5check}" != "77a735a78b1eb819042338859900b83b" ]; then
-	echo "MD5 checksum: FAILED!"
-	read -p "Retry download? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv UTPGPatch451.tar.bz2; fn_filesdl;;
-	[Nn]* ) echo Exiting; exit;;
-	* ) echo "Please answer yes or no.";;
-	esac
-else
-	echo "MD5 checksum: PASSED"
-fi
-echo ""

+ 25 - 30
functions/install_gslt.sh

@@ -2,41 +2,36 @@
 # LGSM install_gslt.sh function
 # LGSM install_gslt.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="270216"
 
 
 # Description: Configures GSLT.
 # Description: Configures GSLT.
 
 
-if [ -z "${autoinstall}" ]; then
-	echo ""
-	echo "Game Server Login Token"
-	echo "============================"
-	sleep 1
-	if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
-		echo "GSLT is required to run a public ${gamename} server"
-	else
-		echo "GSLT is an optional feature for ${gamename} server"
-	fi
+local modulename="Install"
+
+echo ""
+echo "Game Server Login Token"
+echo "============================"
+sleep 1
+if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
+	echo "GSLT is required to run a public ${gamename} server"
+	fn_scriptlog "GSLT is required to run a public ${gamename} server"
+else
+	echo "GSLT is an optional feature for ${gamename} server"
+	fn_scriptlog "GSLT is an optional feature for ${gamename} server"
+fi
 
 
-	echo "Get more info and a token here:"
-	echo "http://gameservermanagers.com/gslt"
-	echo ""
+echo "Get more info and a token here:"
+echo "http://gameservermanagers.com/gslt"
+fn_scriptlog "Get more info and a token here:"
+fn_scriptlog "http://gameservermanagers.com/gslt"
+echo ""
+if [ -z "${autoinstall}" ]; then
 	echo "Enter token below (Can be blank)."
 	echo "Enter token below (Can be blank)."
 	echo -n "GSLT TOKEN: "
 	echo -n "GSLT TOKEN: "
 	read token
 	read token
 	sed -i -e "s/gslt=\"\"/gslt=\"${token}\"/g" "${rootdir}/${selfname}"
 	sed -i -e "s/gslt=\"\"/gslt=\"${token}\"/g" "${rootdir}/${selfname}"
-	sleep 1
-	echo "The GSLT can be changed by editing ${selfname}."
-	echo ""
-else
-	if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
-		fn_printinfomationnl "GSLT is required to run a public ${gamename} server"
-	else
-		fn_printinfomationnl "GSLT is an optional feature for ${gamename} server"
-	fi
-	echo "Get more info and a token here:"
-	echo "http://gameservermanagers.com/gslt"
-	echo ""	
-	sleep 1
-	echo "The GSLT can be changed by editing ${selfname}."	
-	sleep 1
-fi
+fi
+sleep 1
+echo "The GSLT can be changed by editing ${selfname}."
+fn_scriptlog "The GSLT can be changed by editing ${selfname}."
+echo ""

+ 3 - 1
functions/install_header.sh

@@ -4,11 +4,13 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="190216"
 lgsm_version="190216"
 
 
+local modulename="Install"
+
 clear
 clear
 echo "================================="
 echo "================================="
 echo "${gamename}"
 echo "${gamename}"
 echo "Linux Game Server Manager"
 echo "Linux Game Server Manager"
 echo "by Daniel Gibbs"
 echo "by Daniel Gibbs"
+echo "Contributors: http://goo.gl/qLmitD"
 echo "http://gameservermanagers.com"
 echo "http://gameservermanagers.com"
-echo "Contributors: http://gameservermanagers.com/contib"
 echo "================================="
 echo "================================="

+ 5 - 9
functions/install_logs.sh

@@ -2,7 +2,9 @@
 # LGSM install_logs.sh function
 # LGSM install_logs.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="270216"
+
+local modulename="Install"
 
 
 if [ "${checklogs}" != "1" ]; then
 if [ "${checklogs}" != "1" ]; then
 	echo ""
 	echo ""
@@ -31,17 +33,11 @@ if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]||[ "${gamename}" =
 	mkdir -pv "${gamelogdir}"
 	mkdir -pv "${gamelogdir}"
 fi
 fi
 
 
-# If a server is 7 Days to Die.
-if [ "${gamename}" == "7 Days To Die" ]; then
-	if [ ! -h "${gamelogdir}/output_log.txt" ]; then
-		ln -nfsv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt"
-	fi
-fi
-
 # If server uses SteamCMD create a symbolic link to the Steam logs.
 # If server uses SteamCMD create a symbolic link to the Steam logs.
 if [ -d "${rootdir}/Steam/logs" ]; then
 if [ -d "${rootdir}/Steam/logs" ]; then
 	if [ ! -h "${rootdir}/log/steamcmd" ]; then
 	if [ ! -h "${rootdir}/log/steamcmd" ]; then
 		ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd"
 		ln -nfsv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd"
 	fi
 	fi
 fi
 fi
-sleep 1
+sleep 1
+fn_scriptlog "logs installed"

+ 2 - 0
functions/install_retry.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
+local modulename="Install"
+
 while true; do
 while true; do
 	read -e -i "y" -p "Retry install? [Y/n]" yn
 	read -e -i "y" -p "Retry install? [Y/n]" yn
 	case $yn in
 	case $yn in

+ 3 - 1
functions/install_serverdir.sh → functions/install_server_dir.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
+local modulename="Install"
+
 echo ""
 echo ""
 echo "Server Directory"
 echo "Server Directory"
 echo "================================="
 echo "================================="
@@ -12,7 +14,7 @@ echo ""
 pwd
 pwd
 echo ""
 echo ""
 if [ -d "${filesdir}" ]; then
 if [ -d "${filesdir}" ]; then
-	fn_printwarningnl "A server is already installed here."
+	fn_print_warning_nl "A server is already installed here."
 fi
 fi
 if [ -z "${autoinstall}" ]; then	
 if [ -z "${autoinstall}" ]; then	
 	while true; do
 	while true; do

+ 40 - 17
functions/install_serverfiles.sh → functions/install_server_files.sh

@@ -1,13 +1,24 @@
 #!/bin/bash
 #!/bin/bash
-# LGSM finstall_serverfiles.sh function
+# LGSM install_server_files.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="270216"
 
 
-fn_steaminstallcommand(){
-check.sh
+local modulename="Install"
+
+fn_install_server_files(){
+if [ "${gamename}" == "Unreal Tournament 99" ]; then
+	fileurl="http://gameservermanagers.com/files/UnrealTournament99/ut99-server-451-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut99-server-451-ultimate-linux.tar.bz2"; executecmd="noexecute" run="norun"; force="noforce"; md5="49cb24d0550ff6ddeaba6007045c6edd"
+elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
+	fileurl="http://gameservermanagers.com/files/UnrealTournament2004/ut2004-server-3339-ultimate-linux.tar.bz2"; filedir="${lgsmdir}/tmp"; filename="ut2004-server-3339-ultimate-linux.tar.bz2";  executecmd="noexecute" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54"
+fi
+fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
+fn_dl_extract "${filedir}" "${filename}" "${filesdir}"
+}
+
+fn_install_server_files_steamcmd(){
 counter="0"
 counter="0"
-while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .finstall_serverfiles.sh.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .finstall_serverfiles.sh.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .finstall_serverfiles.sh.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .finstall_serverfiles.sh.tmp)" -ge "1" ]; do
+while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do
 	counter=$((counter+1))
 	counter=$((counter+1))
 	cd "${rootdir}/steamcmd"
 	cd "${rootdir}/steamcmd"
 	if [ "${counter}" -le "10" ]; then
 	if [ "${counter}" -le "10" ]; then
@@ -18,7 +29,8 @@ while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .finstall_serverfiles.sh.tmp)
 		# Attempt 11: Failure
 		# Attempt 11: Failure
 
 
 		if [ "${counter}" -ge "2" ]; then
 		if [ "${counter}" -ge "2" ]; then
-			fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}:"
+			fn_print_warning_nl "SteamCMD did not complete the download, retrying: Attempt ${counter}"
+			fn_scriptlog "SteamCMD did not complete the download, retrying: Attempt ${counter}"
 		fi
 		fi
 
 
 		if [ "${counter}" -ge "7" ]; then
 		if [ "${counter}" -ge "7" ]; then
@@ -37,42 +49,53 @@ while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .finstall_serverfiles.sh.tmp)
 
 
 		if [ "${counter}" -le "4" ]; then
 		if [ "${counter}" -le "4" ]; then
 			if [ "${engine}" == "goldsource" ]; then
 			if [ "${engine}" == "goldsource" ]; then
-				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit |tee .finstall_serverfiles.sh.tmp
+				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit
+				local exitcode=$?
 			else
 			else
-				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .finstall_serverfiles.sh.tmp
+				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit
+				local exitcode=$?
 			fi
 			fi
 		elif [ "${counter}" -ge "5" ]; then
 		elif [ "${counter}" -ge "5" ]; then
 			if [ "${engine}" == "goldsource" ]; then
 			if [ "${engine}" == "goldsource" ]; then
-				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp
+				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -validate +quit
+				local exitcode=$?
 			else
 			else
-				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp
+				${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit
+				local exitcode=$?
 			fi
 			fi
 		fi
 		fi
 	elif [ "${counter}" -ge "11" ]; then
 	elif [ "${counter}" -ge "11" ]; then
-		fn_printfailurenl "SteamCMD did not complete the download, too many retrys"
+		fn_print_failure_nl "SteamCMD did not complete the download, too many retrys"
+		fn_scriptlog "SteamCMD did not complete the download, too many retrys"
 		break
 		break
 	fi
 	fi
-
 done
 done
 
 
 # Goldsource servers commonly fail to download all the server files required.
 # Goldsource servers commonly fail to download all the server files required.
 # Validating a few of times may reduce the chance of this issue.
 # Validating a few of times may reduce the chance of this issue.
 if [ "${engine}" == "goldsource" ]; then
 if [ "${engine}" == "goldsource" ]; then
+	fn_print_infomation_nl "Goldsource servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue."
 	counter="0"
 	counter="0"
 	while [ "${counter}" -le "4" ]; do
 	while [ "${counter}" -le "4" ]; do
 		counter=$((counter+1))
 		counter=$((counter+1))
-		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit |tee .finstall_serverfiles.sh.tmp
+		${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" -validate +quit
+		local exitcode=$?
 	done
 	done
 fi
 fi
-rm -f .finstall_serverfiles.sh.tmp
 }
 }
 
 
 echo ""
 echo ""
 echo "Installing ${gamename} Server"
 echo "Installing ${gamename} Server"
 echo "================================="
 echo "================================="
 sleep 1
 sleep 1
-mkdir -pv "${filesdir}"
-fn_steaminstallcommand
+if [ -n "${appid}" ]; then
+	fn_install_server_files_steamcmd
+fi
+
+if [ -z "${appid}" ]||[ "${gamename}" == "GoldenEye: Source" ]; then
+	fn_install_server_files
+fi
+
 if [ -z "${autoinstall}" ]; then
 if [ -z "${autoinstall}" ]; then
 	echo ""
 	echo ""
 	echo "================================="
 	echo "================================="
@@ -84,4 +107,4 @@ if [ -z "${autoinstall}" ]; then
 			* ) echo "Please answer yes or no.";;
 			* ) echo "Please answer yes or no.";;
 		esac
 		esac
 	done
 	done
-fi
+fi

+ 2 - 0
functions/install_steamcmd.sh

@@ -6,6 +6,8 @@ lgsm_version="271215"
 
 
 # Description: Downloads SteamCMD on install.
 # Description: Downloads SteamCMD on install.
 
 
+local modulename="Install"
+
 echo ""
 echo ""
 echo "Installing SteamCMD"
 echo "Installing SteamCMD"
 echo "================================="
 echo "================================="

+ 5 - 3
functions/install_ts3.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
+local modulename="Install"
+
 info_distro.sh
 info_distro.sh
 # Gets the teamspeak server architecture
 # Gets the teamspeak server architecture
 if [ "${arch}" == "x86_64" ]; then
 if [ "${arch}" == "x86_64" ]; then
@@ -11,7 +13,7 @@ if [ "${arch}" == "x86_64" ]; then
 elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
 elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
 	ts3arch="x86"
 	ts3arch="x86"
 else
 else
-	fn_printfailure "${arch} is an unsupported architecture"
+	fn_print_failure "${arch} is an unsupported architecture"
 	exit 1
 	exit 1
 fi
 fi
 
 
@@ -41,9 +43,9 @@ rm -f ".ts3_version_numbers.tmp"
 
 
 # Checks availablebuild info is available
 # Checks availablebuild info is available
 if [ -z "${availablebuild}" ]; then
 if [ -z "${availablebuild}" ]; then
-	fn_printfail "Checking for update: teamspeak.com"
+	fn_print_fail "Checking for update: teamspeak.com"
 	sleep 1
 	sleep 1
-	fn_printfail "Checking for update: teamspeak.com: Not returning version info"
+	fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
 	sleep 2
 	sleep 2
 	exit 1
 	exit 1
 fi
 fi

+ 3 - 1
functions/install_ts3db.sh

@@ -5,6 +5,8 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
+local modulename="Install"
+
 fn_install_ts3db_mariadb(){
 fn_install_ts3db_mariadb(){
 	echo ""
 	echo ""
 	echo "checking if libmariadb2 is installed"
 	echo "checking if libmariadb2 is installed"
@@ -53,7 +55,7 @@ if [ -z "${autoinstall}" ]; then
 		esac
 		esac
 	done
 	done
 else
 else
-fn_printwarningnl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install"
+fn_print_warning_nl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install"
 fi
 fi
 
 
 ## Get privilege key
 ## Get privilege key

+ 0 - 42
functions/install_ut2k4.sh

@@ -1,42 +0,0 @@
-#!/bin/bash
-# LGSM install_ut2k4.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Installing ${gamename} Server"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-echo "Extracting dedicatedserver3339-bonuspack.zip"
-sleep 1
-unzip dedicatedserver3339-bonuspack.zip
-echo "Extracting ut2004-lnxpatch3369-2.tar.bz2"
-sleep 1
-tar -xvjf ut2004-lnxpatch3369-2.tar.bz2 UT2004-Patch/ --strip-components=1
-while true; do
-	read -p "Was the install successful? [y/N]" yn
-	case $yn in
-	[Yy]* ) break;;
-	[Nn]* ) install_retry.sh;;
-	* ) echo "Please answer yes or no.";;
-esac
-done
-while true; do
-	read -p "Remove ut2004-lnxpatch3369-2.tar.bz2? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; break;;
-	[Nn]* ) break;;
-	* ) echo "Please answer yes or no.";;
-	esac
-done
-while true; do
-	read -p "Remove dedicatedserver3339-bonuspack.zip? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; break;;
-	[Nn]* ) break;;
-	* ) echo "Please answer yes or no.";;
-	esac
-done
-echo ""

+ 13 - 4
functions/install_ut2k4_key.sh

@@ -4,6 +4,8 @@
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
 lgsm_version="271215"
 lgsm_version="271215"
 
 
+local modulename="Install"
+
 echo ""
 echo ""
 echo "Enter ${gamename} CD Key"
 echo "Enter ${gamename} CD Key"
 echo "================================="
 echo "================================="
@@ -12,8 +14,15 @@ echo "To get your server listed on the Master Server list"
 echo "you must get a free CD key. Get a key here:"
 echo "you must get a free CD key. Get a key here:"
 echo "http://www.unrealtournament.com/ut2004server/cdkey.php"
 echo "http://www.unrealtournament.com/ut2004server/cdkey.php"
 echo ""
 echo ""
-echo "Once you have the key enter it below"
-echo -n "KEY: "
-read CODE
-echo ""\""CDKey"\""="\""${CODE}"\""" > "${systemdir}/cdkey"
+if [ -z "${autoinstall}" ]; then
+	echo "Once you have the key enter it below"
+	echo -n "KEY: "
+	read CODE
+	echo ""\""CDKey"\""="\""${CODE}"\""" > "${systemdir}/cdkey"
+	if [ -f "${systemdir}/cdkey" ]; then
+	fn_scriptlog "UT2K4 Server CD Key created"
+else
+	echo "You can add your key using the following command"
+	echo "./${selfname} server-cd-key"
+fi	
 echo ""
 echo ""

+ 0 - 42
functions/install_ut99.sh

@@ -1,42 +0,0 @@
-#!/bin/bash
-# LGSM install_ut99.sh function
-# Author: Daniel Gibbs
-# Website: http://gameservermanagers.com
-lgsm_version="271215"
-
-echo ""
-echo "Installing ${gamename} Server"
-echo "================================="
-sleep 1
-cd "${filesdir}"
-echo "Extracting ut-server-436.tar.gz"
-sleep 1
-tar -zxvf ut-server-436.tar.gz ut-server/ --strip-components=1
-echo "Extracting UTPGPatch451.tar.bz2"
-sleep 1
-tar -jxvf UTPGPatch451.tar.bz2
-while true; do
-	read -p "Was the install successful? [y/N]" yn
-	case $yn in
-	[Yy]* ) break;;
-	[Nn]* ) install_retry.sh;;
-	* ) echo "Please answer yes or no.";;
-esac
-done
-while true; do
-	read -p "Remove ut-server-436.tar.gz? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv ut-server-436.tar.gz; break;;
-	[Nn]* ) break;;
-	* ) echo "Please answer yes or no.";;
-	esac
-done
-while true; do
-	read -p "Remove UTPGPatch451.tar.bz2? [y/N]" yn
-	case $yn in
-	[Yy]* ) rm -fv UTPGPatch451.tar.bz2; break;;
-	[Nn]* ) break;;
-	* ) echo "Please answer yes or no.";;
-	esac
-done
-echo ""

+ 11 - 17
functions/logs.sh

@@ -29,7 +29,7 @@ fi
 
 
 # Log manager will start the cleanup if it finds logs older than "${logdays}"
 # Log manager will start the cleanup if it finds logs older than "${logdays}"
 if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
 if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; then
-	fn_printdots "Starting"
+	fn_print_dots "Starting"
 	# Set addon logs directories
 	# Set addon logs directories
 	sourcemodlogdir="${systemdir}/addons/sourcemod/logs"
 	sourcemodlogdir="${systemdir}/addons/sourcemod/logs"
 	ulxlogdir="${systemdir}/data/ulx_logs"
 	ulxlogdir="${systemdir}/data/ulx_logs"
@@ -38,28 +38,24 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
 	# Setting up counting variables
 	# Setting up counting variables
 	scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0"
 	scriptcount="0" ; consolecount="0" ; gamecount="0" ; srcdscount="0" ; smcount="0" ; ulxcount="0" ; darkrpcount="0" ; legacycount="0"
 	sleep 1
 	sleep 1
-	fn_printok "Starting"
+	fn_print_ok_nl "Starting"
 	fn_scriptlog "Starting"
 	fn_scriptlog "Starting"
-	sleep 1
-	echo -en "\n"
-	fn_printinfo "Removing logs older than "${logdays}" days"
+	fn_print_info_nl "Removing logs older than "${logdays}" days"
 	fn_scriptlog "Removing logs older than "${logdays}" days"
 	fn_scriptlog "Removing logs older than "${logdays}" days"
-	sleep 1
-	echo -en "\n"
 	# Logging logfiles to be removed according to "${logdays}", counting and removing them
 	# Logging logfiles to be removed according to "${logdays}", counting and removing them
 	# Script logfiles
 	# Script logfiles
-	find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+	find "${scriptlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
 	scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 	scriptcount=$(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 	find "${scriptlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	find "${scriptlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	# SRCDS and unreal logfiles
 	# SRCDS and unreal logfiles
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
 	if [ "${engine}" == "unreal2" ]||[ "${engine}" == "source" ]; then
-		find "${gamelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+		find "${gamelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
 		gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 		gamecount=$(find "${gamelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 		find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 		find "${gamelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	fi
 	fi
 	# Console logfiles
 	# Console logfiles
 	if [ -n "${consolelog}" ]; then
 	if [ -n "${consolelog}" ]; then
-		find "${consolelogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+		find "${consolelogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
 		consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 		consolecount=$(find "${consolelogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 		find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 		find "${consolelogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 	fi
 	fi
@@ -67,7 +63,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
 	if [ "${engine}" == "source" ]; then
 	if [ "${engine}" == "source" ]; then
 		# SourceMod logfiles
 		# SourceMod logfiles
 		if [ -d "${sourcemodlogdir}" ]; then
 		if [ -d "${sourcemodlogdir}" ]; then
-			find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+			find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
 			smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 			smcount=$(find "${sourcemodlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 			find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 			find "${sourcemodlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 		fi
 		fi
@@ -75,13 +71,13 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
 		if [ "${gamename}" == "Garry's Mod" ]; then
 		if [ "${gamename}" == "Garry's Mod" ]; then
 			# ULX logfiles
 			# ULX logfiles
 			if [ -d "${ulxlogdir}" ]; then
 			if [ -d "${ulxlogdir}" ]; then
-				find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+				find "${ulxlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
 				ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 				ulxcount=$(find "${ulxlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 				find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 				find "${ulxlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 			fi
 			fi
 			# DarkRP logfiles
 			# DarkRP logfiles
 			if [ -d "${darkrplogdir}" ]; then
 			if [ -d "${darkrplogdir}" ]; then
-				find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+				find "${darkrplogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
 				darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 				darkrpcount=$(find "${darkrplogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 				find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 				find "${darkrplogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 			fi
 			fi
@@ -89,7 +85,7 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
 	fi
 	fi
 	# Legacy support
 	# Legacy support
 	if [ -d "${legacyserverlogdir}" ]; then
 	if [ -d "${legacyserverlogdir}" ]; then
-		find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|tee >> "${scriptlog}"
+		find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"| tee >> "${scriptlog}"
 		legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 		legacycount=$(find "${legacyserverlogdir}"/ -type f -mtime +"${logdays}"|wc -l)
 		find "${legacyserverlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 		find "${legacyserverlogdir}"/ -mtime +"${logdays}" -type f -exec rm -f {} \;
 		# Remove folder if empty
 		# Remove folder if empty
@@ -101,8 +97,6 @@ if [ $(find "${scriptlogdir}"/ -type f -mtime +"${logdays}"|wc -l) -ne "0" ]; th
 	# Count total amount of files removed
 	# Count total amount of files removed
 	count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount}))
 	count=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount} + ${legacycount}))
 	# Job done
 	# Job done
-	fn_printok "Removed ${count} log files"
+	fn_print_ok_nl "Removed ${count} log files"
 	fn_scriptlog "Removed ${count} log files"
 	fn_scriptlog "Removed ${count} log files"
-	sleep 1
-	echo -en "\n"
 fi
 fi

+ 78 - 82
functions/monitor_gsquery.sh

@@ -2,96 +2,92 @@
 # LGSM monitor_gsquery.sh function
 # LGSM monitor_gsquery.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="271215"
+lgsm_version="270216"
 
 
-# Description: uses gsquery.py to directly query the server.
-# Detects if the server has frozen.
+# Description: uses gsquery.py to query the server port.
+# Detects if the server has frozen with the proccess still running.
 
 
 local modulename="Monitor"
 local modulename="Monitor"
-if [ -f "${rootdir}/gsquery.py" ]; then
+
+# Forces legecy servers to use gsquery as vat gsquery is not present in legecy
+if [ -z "${gsquery}" ]; then
+	gsquery="yes"
+fi	 
+
+if [ "${gsquery}" == "yes" ]; then
+
+	# Downloads gsquery.py if missing
+	if [ ! -f "${functionsdir}/gsquery.py" ]; then
+		fn_fetch_file_github "functions" "gsquery.py" "${functionsdir}" "executecmd" "norun" "noforce" "nomd5"
+	fi	
+
+	info_config.sh
+
 	if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
 	if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
-		gameport=$(grep Port= "${servercfgfullpath}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd '[:digit:]')
-		port=$((${gameport} + 1))
+		port=$((port + 1))
 	elif [ "${engine}" == "spark" ]; then
 	elif [ "${engine}" == "spark" ]; then
-		port=$((${port} + 1))
-	elif [ "${engine}" == "realvirtuality" ]; then
-		queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd '[:digit:]')
-		port=${queryport}
-	elif [ "${gamename}" == "7 Days To Die" ]; then
-		gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd '[:digit:]')
-		port=$((${gameport} + 1))
-	elif [ "${gamename}" == "Hurtworld" ]; then
-		gameport="${port}"
+		port=$((port + 1))
+	fi
+
+	if [ -z "${queryport}" ]; then
 		port="${queryport}"
 		port="${queryport}"
 	fi
 	fi
-	fn_printinfo "Detected gsquery.py"
-	fn_scriptlog "Detected gsquery.py"
-	sleep 1
-	fn_printdots "Querying port: ${ip}:${port} : QUERYING"
-	fn_scriptlog "Querying port: ${ip}:${port} : QUERYING"
+
+	fn_print_info "Querying port: gsquery.py enabled"
+	fn_scriptlog "Querying port: gsquery.py enabled"
 	sleep 1
 	sleep 1
-	serverquery=$("${rootdir}/gsquery.py" -a ${ip} -p ${port} -e ${engine} 2>&1)
-	exitcode=$?
-	if [ "${exitcode}" == "1" ]||[ "${exitcode}" == "2" ]||[ "${exitcode}" == "3" ]||[ "${exitcode}" == "4" ]; then
-		fn_printfail "Querying port: ${ip}:${port} : ${serverquery}"
-		fn_scriptlog "Querying port: ${ip}:${port} : ${serverquery}"
-		sleep 1
-		echo -en "\n"
-		if [ -z "${secondquery}" ]; then
-			if [ "${engine}" == "unreal2" ]; then
-				# unreal 2: Map change can take around 60 seconds
-				fn_printinfo "Waiting 60 seconds to re-query"
-				fn_scriptlog "Waiting 60 seconds to re-query"
-				sleep 60
-			else
-				fn_printinfo "Waiting 30 seconds to re-query"
-				fn_scriptlog "Waiting 30 seconds to re-query"
-				sleep 30
-			fi
-			secondquery=1
-			monitor_gsquery.sh
-		fi
-		if [ "${emailnotification}" = "on" ]; then
-			info_config.sh
-			subject="${servicename} Monitor - Starting ${servername}"
-			failurereason="Failed to query ${servicename}: ${serverquery}"
-			actiontaken="restarted ${servicename}"
-			email.sh
-		fi
-		fn_restart
-		exit 1
-	elif [ "${exitcode}" == "0" ]; then
-		fn_printok "Querying port: ${ip}:${port} : OK"
-		fn_scriptlog "Querying port: ${ip}:${port} : OK"
-		sleep 1
-		echo -en "\n"
-		exit
-	elif [ "${exitcode}" == "126" ]; then
-		fn_printfail "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied"
-		fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ${rootdir}/gsquery.py: Permission denied"
+
+	# Will query up to 4 times every 15 seconds.
+	# Servers changing map can return a failure.
+	# Will Wait up to 60 seconds to confirm server is down giving server time to change map.
+	totalseconds=0
+	for queryattempt in {1..5}; do
+		fn_print_dots "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : "
+		fn_print_querying_eol
+		fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : QUERYING"
+		
+		gsquerycmd=$("${functionsdir}"/gsquery.py -a "${ip}" -p 1 -e "${engine}" 2>&1)
+		exitcode=$?
+
 		sleep 1
 		sleep 1
-		echo -en "\n"
-		echo "Attempting to resolve automatically"
-		chmod +x -v "${rootdir}/gsquery.py"
-		if [ $? -eq 0 ]; then
-			monitor_gsquery.sh
+		if [ "${exitcode}" == "0" ]; then
+			# Server OK
+			fn_print_ok "Querying port: ${ip}:${port} : ${queryattempt} : "
+			fn_print_ok_eol
+			fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : OK"
+			sleep 1
+			exit
 		else
 		else
-			fn_printfailure "Unable to resolve automatically. Please manually fix permissions.\n"
-			owner=$(ls -al ${rootdir}/gsquery.py|awk '{ print $3 }')
-			echo "As user ${owner} or root run the following command."
-			whoami=$(whoami)
-			echo -en "\nchown ${whoami}:${whoami} ${rootdir}/gsquery.py\n\n"
-		exit 1
+			# Server failed query
+			fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : ${gsquerycmd}"
+
+			if [ "${queryattempt}" == "5" ]; then
+				# Server failed query 4 times confirmed failure
+				fn_print_fail "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : "
+				fn_print_fail_eol_nl
+				fn_scriptlog "Querying port: ${ip}:${port} : ${queryattempt} : FAIL"
+				sleep 1
+
+				# Send email notification if enabled
+				if [ "${emailnotification}" == "on" ]; then
+					subject="${servicename} Monitor - Starting ${servername}"
+					failurereason="Failed to query ${servicename}: ${gsquerycmd}"
+					actiontaken="restarted ${servicename}"
+					email.sh
+				fi
+				fn_restart
+				break
+			fi
+
+			# Seconds counter
+			for seconds in {1..15}; do
+				fn_print_fail "Querying port: ${ip}:${port} : ${totalseconds}/${queryattempt} : \e[0;31m${gsquerycmd}\e[0m"
+				totalseconds=$((totalseconds + 1))
+				sleep 1
+				if [ "${seconds}" == "15" ]; then
+					break
+				fi
+			done
 		fi
 		fi
-	else
-		fn_printfail "Querying port: ${ip}:${port} : UNKNOWN ERROR"
-		fn_scriptlog "Querying port: ${ip}:${port} : UNKNOWN ERROR"
-		sleep 1
-		echo -en "\n"
-		${rootdir}/gsquery.py -a ${ip} -p ${port} -e ${engine}
-		exit 1
-	fi
-else
-	fn_printfailnl "Could not find ${rootdir}/gsquery.py"
-	fn_scriptlog "Could not find ${rootdir}/gsquery.py"
-fi
+	done
+fi

+ 27 - 27
functions/update_check.sh

@@ -22,10 +22,10 @@ fn_appmanifestinfo
 # This is an error is corrected below if required.
 # This is an error is corrected below if required.
 if [ "${appmanifestfilewc}" -ge "2" ]; then
 if [ "${appmanifestfilewc}" -ge "2" ]; then
 	sleep 1
 	sleep 1
-	fn_printwarn "Multiple appmanifest_${appid}.acf files found"
+	fn_print_warn "Multiple appmanifest_${appid}.acf files found"
 	fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found"
 	fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found"
 	sleep 2
 	sleep 2
-	fn_printdots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
+	fn_print_dots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
 	sleep 1
 	sleep 1
 	for appfile in ${appmanifestfile}; do
 	for appfile in ${appmanifestfile}; do
 		rm "${appfile}"
 		rm "${appfile}"
@@ -33,7 +33,7 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then
 	appmanifestfilewc1="${appmanifestfilewc}"
 	appmanifestfilewc1="${appmanifestfilewc}"
 	fn_appmanifestinfo
 	fn_appmanifestinfo
 	if [ "${appmanifestfilewc}" -ge "2" ]; then
 	if [ "${appmanifestfilewc}" -ge "2" ]; then
-		fn_printfail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
+		fn_print_fail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
 		fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
 		fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
 		sleep 1
 		sleep 1
 		echo ""
 		echo ""
@@ -44,10 +44,10 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then
 		exit 1
 		exit 1
 	else
 	else
 		sleep 1
 		sleep 1
-		fn_printok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
+		fn_print_ok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
 		fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
 		fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
 		sleep 1
 		sleep 1
-		fn_printinfonl "Forcing update to correct issue"
+		fn_print_info_nl "Forcing update to correct issue"
 		fn_scriptlog "Forcing update to correct issue"
 		fn_scriptlog "Forcing update to correct issue"
 		sleep 1
 		sleep 1
 		update_dl.sh
 		update_dl.sh
@@ -55,15 +55,15 @@ if [ "${appmanifestfilewc}" -ge "2" ]; then
 	fi
 	fi
 elif [ "${appmanifestfilewc}" -eq "0" ]; then
 elif [ "${appmanifestfilewc}" -eq "0" ]; then
 	if [ "${forceupdate}" == "1" ]; then
 	if [ "${forceupdate}" == "1" ]; then
-		fn_printfail "Still no appmanifest_${appid}.acf found: Unable to update"
+		fn_print_fail "Still no appmanifest_${appid}.acf found: Unable to update"
 		fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update"
 		fn_scriptlog "Warning! Still no appmanifest_${appid}.acf found: Unable to update"
 		exit 1
 		exit 1
 	fi
 	fi
 	forceupdate=1
 	forceupdate=1
-	fn_printwarn "No appmanifest_${appid}.acf found"
+	fn_print_warn "No appmanifest_${appid}.acf found"
 	fn_scriptlog "Warning! No appmanifest_${appid}.acf found"
 	fn_scriptlog "Warning! No appmanifest_${appid}.acf found"
 	sleep 2
 	sleep 2
-	fn_printinfonl "Forcing update to correct issue"
+	fn_print_info_nl "Forcing update to correct issue"
 	fn_scriptlog "Forcing update to correct issue"
 	fn_scriptlog "Forcing update to correct issue"
 	sleep 1
 	sleep 1
 	update_dl.sh
 	update_dl.sh
@@ -73,12 +73,12 @@ fi
 
 
 fn_logupdaterequest(){
 fn_logupdaterequest(){
 # Checks for server update requests from server logs.
 # Checks for server update requests from server logs.
-fn_printdots "Checking for update: Server logs"
+fn_print_dots "Checking for update: Server logs"
 fn_scriptlog "Checking for update: Server logs"
 fn_scriptlog "Checking for update: Server logs"
 sleep 1
 sleep 1
 requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
 requestrestart=$(grep -Ec "MasterRequestRestart" "${consolelog}")
 if [ "${requestrestart}" -ge "1" ]; then
 if [ "${requestrestart}" -ge "1" ]; then
-	fn_printoknl "Checking for update: Server logs: Update requested"
+	fn_print_ok_nl "Checking for update: Server logs: Update requested"
 	sleep 1
 	sleep 1
 	echo ""
 	echo ""
 	echo -ne "Applying update.\r"
 	echo -ne "Applying update.\r"
@@ -98,7 +98,7 @@ if [ "${requestrestart}" -ge "1" ]; then
 		update_dl.sh
 		update_dl.sh
 	fi
 	fi
 else
 else
-	fn_printok "Checking for update: Server logs: No update requested"
+	fn_print_ok "Checking for update: Server logs: No update requested"
 	sleep 1
 	sleep 1
 fi
 fi
 }
 }
@@ -106,7 +106,7 @@ fi
 fn_steamcmdcheck(){
 fn_steamcmdcheck(){
 fn_appmanifestcheck
 fn_appmanifestcheck
 # Checks for server update from SteamCMD
 # Checks for server update from SteamCMD
-fn_printdots "Checking for update: SteamCMD"
+fn_print_dots "Checking for update: SteamCMD"
 fn_scriptlog "Checking for update: SteamCMD"
 fn_scriptlog "Checking for update: SteamCMD"
 sleep 1
 sleep 1
 
 
@@ -122,14 +122,14 @@ if [ -f "${HOME}/Steam/appcache/appinfo.vdf" ]; then
 fi
 fi
 availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f3)
 availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +app_info_print "${appid}" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\  -f3)
 if [ -z "${availablebuild}" ]; then
 if [ -z "${availablebuild}" ]; then
-	fn_printfail "Checking for update: SteamCMD"
+	fn_print_fail "Checking for update: SteamCMD"
 	fn_scriptlog "Failure! Checking for update: SteamCMD"
 	fn_scriptlog "Failure! Checking for update: SteamCMD"
 	sleep 1
 	sleep 1
-	fn_printfailnl "Checking for update: SteamCMD: Not returning version info"
+	fn_print_fail_nl "Checking for update: SteamCMD: Not returning version info"
 	fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info"
 	fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info"
 	exit 1
 	exit 1
 else
 else
-	fn_printok "Checking for update: SteamCMD"
+	fn_print_ok "Checking for update: SteamCMD"
 	fn_scriptlog "Success! Checking for update: SteamCMD"
 	fn_scriptlog "Success! Checking for update: SteamCMD"
 	sleep 1
 	sleep 1
 fi
 fi
@@ -172,7 +172,7 @@ else
 	echo -e "	Available version: \e[0;32m${availablebuild}\e[0;39m"
 	echo -e "	Available version: \e[0;32m${availablebuild}\e[0;39m"
 	echo -e "	https://steamdb.info/app/${appid}/"
 	echo -e "	https://steamdb.info/app/${appid}/"
 	echo -e ""
 	echo -e ""
-	fn_printoknl "No update available"
+	fn_print_ok_nl "No update available"
 	fn_scriptlog "Current build: ${currentbuild}"
 	fn_scriptlog "Current build: ${currentbuild}"
 	fn_scriptlog "Available build: ${availablebuild}"
 	fn_scriptlog "Available build: ${availablebuild}"
 fi
 fi
@@ -182,19 +182,19 @@ fi
 
 
 fn_teamspeak3_check(){
 fn_teamspeak3_check(){
 # Checks for server update from teamspeak.com using a mirror dl.4players.de
 # Checks for server update from teamspeak.com using a mirror dl.4players.de
-fn_printdots "Checking for update: teamspeak.com"
+fn_print_dots "Checking for update: teamspeak.com"
 fn_scriptlog "Checking for update: teamspeak.com"
 fn_scriptlog "Checking for update: teamspeak.com"
 sleep 1
 sleep 1
 
 
 # Gets currentbuild info
 # Gets currentbuild info
 # Checks currentbuild info is available, if fails a server restart will be forced to generate logs
 # Checks currentbuild info is available, if fails a server restart will be forced to generate logs
 if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
 if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
-	fn_printfail "Checking for update: teamspeak.com"
+	fn_print_fail "Checking for update: teamspeak.com"
 	sleep 1
 	sleep 1
-	fn_printfailnl "Checking for update: teamspeak.com: No logs with server version found"
+	fn_print_fail_nl "Checking for update: teamspeak.com: No logs with server version found"
 	fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found"
 	fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found"
 	sleep 2
 	sleep 2
-	fn_printinfonl "Checking for update: teamspeak.com: Forcing server restart"
+	fn_print_info_nl "Checking for update: teamspeak.com: Forcing server restart"
 	fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart"
 	fn_scriptlog "Checking for update: teamspeak.com: Forcing server restart"
 	sleep 2
 	sleep 2
 	command_stop.sh
 	command_stop.sh
@@ -202,7 +202,7 @@ if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
 	sleep 2
 	sleep 2
 	# If still failing will exit
 	# If still failing will exit
 	if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
 	if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then
-		fn_printfailnl "Checking for update: teamspeak.com: Still No logs with server version found"
+		fn_print_fail_nl "Checking for update: teamspeak.com: Still No logs with server version found"
 		fn_scriptlog "Failure! Checking for update: teamspeak.com: Still No logs with server version found"
 		fn_scriptlog "Failure! Checking for update: teamspeak.com: Still No logs with server version found"
 		exit 1
 		exit 1
 	fi
 	fi
@@ -217,7 +217,7 @@ elif [ "${arch}" == "i386" ]||[ "${arch}" == "i686" ]; then
 	ts3arch="x86"
 	ts3arch="x86"
 else
 else
 	echo ""
 	echo ""
-	fn_printfailure "${arch} is an unsupported architecture"
+	fn_print_failure "${arch} is an unsupported architecture"
 	exit 1
 	exit 1
 fi
 fi
  
  
@@ -245,15 +245,15 @@ rm -f ".ts3_version_numbers_sorted.tmp"
 
 
 # Checks availablebuild info is available
 # Checks availablebuild info is available
 if [ -z "${availablebuild}" ]; then
 if [ -z "${availablebuild}" ]; then
-	fn_printfail "Checking for update: teamspeak.com"
+	fn_print_fail "Checking for update: teamspeak.com"
 	fn_scriptlog "Checking for update: teamspeak.com"
 	fn_scriptlog "Checking for update: teamspeak.com"
 	sleep 1
 	sleep 1
-	fn_printfail "Checking for update: teamspeak.com: Not returning version info"
+	fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
 	fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
 	fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
 	sleep 2
 	sleep 2
 	exit 1
 	exit 1
 else
 else
-	fn_printok "Checking for update: teamspeak.com"
+	fn_print_ok "Checking for update: teamspeak.com"
 	fn_scriptlog "Success! Checking for update: teamspeak.com"
 	fn_scriptlog "Success! Checking for update: teamspeak.com"
 	sleep 1
 	sleep 1
 fi
 fi
@@ -299,14 +299,14 @@ else
 	echo -e "	Current version: \e[0;32m${currentbuild}\e[0;39m"
 	echo -e "	Current version: \e[0;32m${currentbuild}\e[0;39m"
 	echo -e "	Available version: \e[0;32m${availablebuild}\e[0;39m"
 	echo -e "	Available version: \e[0;32m${availablebuild}\e[0;39m"
 	echo -e ""
 	echo -e ""
-	fn_printoknl "No update available"
+	fn_print_ok_nl "No update available"
 	fn_scriptlog "Current build: ${currentbuild}"
 	fn_scriptlog "Current build: ${currentbuild}"
 	fn_scriptlog "Available build: ${availablebuild}"
 	fn_scriptlog "Available build: ${availablebuild}"
 fi
 fi
 }
 }
 
 
 check.sh
 check.sh
-fn_printdots "Checking for update"
+fn_print_dots "Checking for update"
 if [ "${gamename}" == "Teamspeak 3" ]; then
 if [ "${gamename}" == "Teamspeak 3" ]; then
 	fn_teamspeak3_check
 	fn_teamspeak3_check
 elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then
 elif [ "${engine}" == "goldsource" ]||[ "${forceupdate}" == "1" ]; then

+ 4 - 4
functions/update_dl.sh

@@ -19,9 +19,9 @@ if [ $(command -v unbuffer) ]; then
 fi
 fi
 
 
 if [ "${engine}" == "goldsource" ]; then
 if [ "${engine}" == "goldsource" ]; then
-	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit|tee -a "${scriptlog}"
+	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +quit| tee -a "${scriptlog}"
 else
 else
-	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}"
+	${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit| tee -a "${scriptlog}"
 fi
 fi
 
 
 fix.sh
 fix.sh
@@ -71,9 +71,9 @@ rm -rf "${rootdir}/teamspeak3-server_linux_${ts3arch}"
 
 
 check.sh
 check.sh
 info_config.sh
 info_config.sh
-fn_printdots "Updating ${servername}"
+fn_print_dots "Updating ${servername}"
 sleep 1
 sleep 1
-fn_printoknl "Updating ${servername}"
+fn_print_ok_nl "Updating ${servername}"
 fn_scriptlog "Updating ${servername}"
 fn_scriptlog "Updating ${servername}"
 sleep 1
 sleep 1
 if [ "${gamename}" == "Teamspeak 3" ]; then
 if [ "${gamename}" == "Teamspeak 3" ]; then

+ 6 - 6
tests/tests_jc2server.sh

@@ -325,7 +325,7 @@ echo "Description:"
 echo "change the buildid tricking SteamCMD to update."
 echo "change the buildid tricking SteamCMD to update."
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
-fn_printinfonl "changed buildid to 0."
+fn_print_info_nl "changed buildid to 0."
 sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf
 sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf
 update_check.sh
 update_check.sh
 echo ""
 echo ""
@@ -338,7 +338,7 @@ echo "Description:"
 echo "change the buildid tricking SteamCMD to update server while already running."
 echo "change the buildid tricking SteamCMD to update server while already running."
 requiredstatus="ONLINE"
 requiredstatus="ONLINE"
 fn_setstatus
 fn_setstatus
-fn_printinfonl "changed buildid to 0."
+fn_print_info_nl "changed buildid to 0."
 sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf
 sed -i 's/[0-9]\+/0/' ${filesdir}/steamapps/appmanifest_${appid}.acf
 update_check.sh
 update_check.sh
 echo ""
 echo ""
@@ -351,7 +351,7 @@ echo "Description:"
 echo "removing appmanifest file will cause script to repair."
 echo "removing appmanifest file will cause script to repair."
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
-fn_printinfonl "removed appmanifest_${appid}.acf."
+fn_print_info_nl "removed appmanifest_${appid}.acf."
 rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf"
 rm --verbose "${filesdir}/steamapps/appmanifest_${appid}.acf"
 update_check.sh
 update_check.sh
 echo ""
 echo ""
@@ -433,7 +433,7 @@ echo "Description:"
 echo "run monitor while server is offline with no lockfile."
 echo "run monitor while server is offline with no lockfile."
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
-fn_printinfonl "creating lockfile."
+fn_print_info_nl "creating lockfile."
 date > "${rootdir}/${lockselfname}"
 date > "${rootdir}/${lockselfname}"
 (command_monitor.sh)
 (command_monitor.sh)
 echo ""
 echo ""
@@ -449,7 +449,7 @@ fn_setstatus
 sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
 sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
 (command_monitor.sh)
 (command_monitor.sh)
 echo ""
 echo ""
-fn_printinfonl "Reseting ${servercfg}."
+fn_print_info_nl "Reseting ${servercfg}."
 install_config.sh
 install_config.sh
 echo ""
 echo ""
 echo "Test complete!"
 echo "Test complete!"
@@ -478,7 +478,7 @@ echo ""
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
 sleep 1
 sleep 1
-fn_printinfo "Tidying up directories."
+fn_print_info "Tidying up directories."
 sleep 1
 sleep 1
 rm -rfv ${serverfiles}
 rm -rfv ${serverfiles}
 echo "END"
 echo "END"

+ 3 - 3
tests/tests_ts3server.sh

@@ -345,7 +345,7 @@ echo "Description:"
 echo "run monitor while server is offline with no lockfile."
 echo "run monitor while server is offline with no lockfile."
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
-fn_printinfonl "creating lockfile."
+fn_print_info_nl "creating lockfile."
 date > "${rootdir}/${lockselfname}"
 date > "${rootdir}/${lockselfname}"
 (command_monitor.sh)
 (command_monitor.sh)
 echo ""
 echo ""
@@ -361,7 +361,7 @@ fn_setstatus
 sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
 sed -i 's/[0-9]\+/0/' "${servercfgfullpath}"
 (command_monitor.sh)
 (command_monitor.sh)
 echo ""
 echo ""
-fn_printinfonl "Reseting ${servercfg}."
+fn_print_info_nl "Reseting ${servercfg}."
 install_config.sh
 install_config.sh
 echo ""
 echo ""
 echo "Test complete!"
 echo "Test complete!"
@@ -390,7 +390,7 @@ echo ""
 requiredstatus="OFFLINE"
 requiredstatus="OFFLINE"
 fn_setstatus
 fn_setstatus
 sleep 1
 sleep 1
-fn_printinfo "Tidying up directories."
+fn_print_info "Tidying up directories."
 sleep 1
 sleep 1
 rm -rfv ${serverfiles}
 rm -rfv ${serverfiles}
 echo "END"
 echo "END"