Explorar o código

feat(core): convert ${curlpath} to using curl and improve code standards (#2616)

Daniel Gibbs %!s(int64=6) %!d(string=hai) anos
pai
achega
835fdee88e
Modificáronse 100 ficheiros con 382 adicións e 402 borrados
  1. 3 3
      lgsm/functions/alert_discord.sh
  2. 1 1
      lgsm/functions/alert_email.sh
  3. 2 2
      lgsm/functions/alert_ifttt.sh
  4. 2 2
      lgsm/functions/alert_mailgun.sh
  5. 2 2
      lgsm/functions/alert_pushbullet.sh
  6. 2 2
      lgsm/functions/alert_pushover.sh
  7. 1 1
      lgsm/functions/alert_slack.sh
  8. 2 2
      lgsm/functions/alert_telegram.sh
  9. 1 1
      lgsm/functions/check_config.sh
  10. 4 4
      lgsm/functions/check_deps.sh
  11. 1 1
      lgsm/functions/check_executable.sh
  12. 1 1
      lgsm/functions/check_logs.sh
  13. 5 6
      lgsm/functions/check_permissions.sh
  14. 1 1
      lgsm/functions/check_root.sh
  15. 1 1
      lgsm/functions/check_status.sh
  16. 1 1
      lgsm/functions/check_system_dir.sh
  17. 1 1
      lgsm/functions/check_system_requirements.sh
  18. 1 1
      lgsm/functions/command_backup.sh
  19. 1 1
      lgsm/functions/command_console.sh
  20. 1 1
      lgsm/functions/command_debug.sh
  21. 1 1
      lgsm/functions/command_details.sh
  22. 1 1
      lgsm/functions/command_dev_debug.sh
  23. 3 3
      lgsm/functions/command_dev_detect_deps.sh
  24. 2 2
      lgsm/functions/command_dev_detect_glibc.sh
  25. 2 2
      lgsm/functions/command_dev_detect_ldd.sh
  26. 1 1
      lgsm/functions/command_dev_query_raw.sh
  27. 1 1
      lgsm/functions/command_donate.sh
  28. 9 9
      lgsm/functions/command_fastdl.sh
  29. 1 1
      lgsm/functions/command_install.sh
  30. 1 1
      lgsm/functions/command_install_resources_mta.sh
  31. 1 1
      lgsm/functions/command_mods_install.sh
  32. 2 2
      lgsm/functions/command_mods_remove.sh
  33. 5 5
      lgsm/functions/command_mods_update.sh
  34. 2 2
      lgsm/functions/command_monitor.sh
  35. 4 4
      lgsm/functions/command_postdetails.sh
  36. 1 1
      lgsm/functions/command_restart.sh
  37. 4 4
      lgsm/functions/command_start.sh
  38. 2 2
      lgsm/functions/command_stop.sh
  39. 1 1
      lgsm/functions/command_test_alert.sh
  40. 1 1
      lgsm/functions/command_ts3_server_pass.sh
  41. 1 1
      lgsm/functions/command_update.sh
  42. 1 1
      lgsm/functions/command_update_functions.sh
  43. 9 8
      lgsm/functions/command_update_linuxgsm.sh
  44. 2 2
      lgsm/functions/command_validate.sh
  45. 1 1
      lgsm/functions/command_wipe.sh
  46. 1 1
      lgsm/functions/compress_unreal2_maps.sh
  47. 1 1
      lgsm/functions/compress_ut99_maps.sh
  48. 6 8
      lgsm/functions/core_dl.sh
  49. 125 125
      lgsm/functions/core_functions.sh
  50. 5 5
      lgsm/functions/core_getopt.sh
  51. 1 1
      lgsm/functions/fix_arma3.sh
  52. 1 1
      lgsm/functions/fix_csgo.sh
  53. 1 1
      lgsm/functions/fix_dst.sh
  54. 1 1
      lgsm/functions/fix_kf.sh
  55. 1 1
      lgsm/functions/fix_kf2.sh
  56. 1 1
      lgsm/functions/fix_mta.sh
  57. 1 1
      lgsm/functions/fix_ro.sh
  58. 1 1
      lgsm/functions/fix_sfc.sh
  59. 1 1
      lgsm/functions/fix_ss3.sh
  60. 1 1
      lgsm/functions/fix_steamcmd.sh
  61. 1 1
      lgsm/functions/fix_terraria.sh
  62. 1 1
      lgsm/functions/fix_tf2.sh
  63. 1 1
      lgsm/functions/fix_ts3.sh
  64. 1 1
      lgsm/functions/fix_ut.sh
  65. 1 1
      lgsm/functions/fix_ut2k4.sh
  66. 1 1
      lgsm/functions/fix_ut3.sh
  67. 1 1
      lgsm/functions/fix_zmr.sh
  68. 8 8
      lgsm/functions/info_config.sh
  69. 17 17
      lgsm/functions/info_distro.sh
  70. 1 1
      lgsm/functions/info_parms.sh
  71. 4 4
      lgsm/functions/info_stats.sh
  72. 1 1
      lgsm/functions/install_complete.sh
  73. 1 1
      lgsm/functions/install_config.sh
  74. 1 1
      lgsm/functions/install_dst_token.sh
  75. 1 1
      lgsm/functions/install_gslt.sh
  76. 1 1
      lgsm/functions/install_header.sh
  77. 5 9
      lgsm/functions/install_logs.sh
  78. 1 1
      lgsm/functions/install_mta_resources.sh
  79. 1 1
      lgsm/functions/install_retry.sh
  80. 1 1
      lgsm/functions/install_server_dir.sh
  81. 2 2
      lgsm/functions/install_server_files.sh
  82. 1 1
      lgsm/functions/install_squad_license.sh
  83. 1 1
      lgsm/functions/install_stats.sh
  84. 1 1
      lgsm/functions/install_ts3db.sh
  85. 1 1
      lgsm/functions/install_ut2k4_key.sh
  86. 1 1
      lgsm/functions/logs.sh
  87. 13 13
      lgsm/functions/mods_core.sh
  88. 8 8
      lgsm/functions/mods_list.sh
  89. 1 1
      lgsm/functions/query_gamedig.sh
  90. 2 2
      lgsm/functions/update_factorio.sh
  91. 4 4
      lgsm/functions/update_minecraft.sh
  92. 4 4
      lgsm/functions/update_mta.sh
  93. 2 2
      lgsm/functions/update_mumble.sh
  94. 2 2
      lgsm/functions/update_steamcmd.sh
  95. 7 7
      lgsm/functions/update_ts3.sh
  96. 8 11
      linuxgsm.sh
  97. 8 11
      tests/tests_fctrserver.sh
  98. 8 10
      tests/tests_jc2server.sh
  99. 8 11
      tests/tests_mcserver.sh
  100. 9 12
      tests/tests_ts3server.sh

+ 3 - 3
lgsm/functions/alert_discord.sh

@@ -10,8 +10,8 @@ if ! command -v jq > /dev/null; then
 	fn_script_log_fatal "Sending Discord alert: jq is missing."
 fi
 
-escaped_servername="$(echo -n "${servername}" | jq -sRr "@json")"
-escaped_alertbody="$(echo -n "${alertbody}" | jq -sRr "@json")"
+escaped_servername=$(echo -n "${servername}" | jq -sRr "@json")
+escaped_alertbody=$(echo -n "${alertbody}" | jq -sRr "@json")
 
 json=$(cat <<EOF
 {
@@ -51,7 +51,7 @@ EOF
 
 fn_print_dots "Sending Discord alert"
 
-discordsend=$(${curlpath} -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${discordwebhook}")
+discordsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${discordwebhook}")
 
 if [ -n "${discordsend}" ]; then
 	fn_print_fail_nl "Sending Discord alert: ${discordsend}"

+ 1 - 1
lgsm/functions/alert_email.sh

@@ -6,7 +6,7 @@
 
 local commandname="ALERT"
 local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_dots "Sending Email alert: ${email}"
 fn_sleep_time

+ 2 - 2
lgsm/functions/alert_ifttt.sh

@@ -6,7 +6,7 @@
 
 local commandname="ALERT"
 local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 json=$(cat <<EOF
 {
@@ -18,7 +18,7 @@ EOF
 )
 
 fn_print_dots "Sending IFTTT alert"
-iftttsend=$(${curlpath} -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")
+iftttsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")
 
 if [ -n "${iftttsend}" ]; then
 	fn_print_fail_nl "Sending IFTTT alert: ${pushbulletsend}"

+ 2 - 2
lgsm/functions/alert_mailgun.sh

@@ -6,11 +6,11 @@
 
 local commandname="ALERT"
 local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_dots "Sending Email alert: Mailgun: ${email}"
 
-mailgunsend=$(${curlpath} -s --user "api:${mailguntoken}" \
+mailgunsend=$(curl -s --user "api:${mailguntoken}" \
 -F from="LinuxGSM <${mailgunemailfrom}>" \
 -F to="LinuxGSM Admin <${mailgunemail}>" \
 -F subject="${alertemoji} ${alertsubject} ${alertemoji}" \

+ 2 - 2
lgsm/functions/alert_pushbullet.sh

@@ -6,7 +6,7 @@
 
 local commandname="ALERT"
 local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 json=$(cat <<EOF
 {
@@ -19,7 +19,7 @@ EOF
 )
 
 fn_print_dots "Sending Pushbullet alert"
-pushbulletsend=$(${curlpath} -sSL -u """${pushbullettoken}"":" -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.pushbullet.com/v2/pushes" | grep "error_code")
+pushbulletsend=$(curl -sSL -u """${pushbullettoken}"":" -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.pushbullet.com/v2/pushes" | grep "error_code")
 
 if [ -n "${pushbulletsend}" ]; then
 	fn_print_fail_nl "Sending Pushbullet alert: ${pushbulletsend}"

+ 2 - 2
lgsm/functions/alert_pushover.sh

@@ -6,7 +6,7 @@
 
 local commandname="ALERT"
 local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_dots "Sending Pushover alert"
 
@@ -23,7 +23,7 @@ else
 	alertpriority="0"
 fi
 
-pushoversend=$(${curlpath} -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}"  -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server name</b><br>${servername}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
+pushoversend=$(curl -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}"  -F priority="${alertpriority}" -F title="${alertemoji} ${alertsubject} ${alertemoji}" -F message=" <b>Message</b><br>${alertbody}<br><br><b>Game</b><br>${gamename}<br><br><b>Server name</b><br>${servername}<br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
 
 if [ -n "${pushoversend}" ]; then
 	fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"

+ 1 - 1
lgsm/functions/alert_slack.sh

@@ -65,7 +65,7 @@ EOF
 
 fn_print_dots "Sending Slack alert"
 
-slacksend=$(${curlpath} -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${slackwebhook}")
+slacksend=$(curl -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${slackwebhook}")
 
 if [ "${slacksend}" == "ok" ]; then
 	fn_print_ok_nl "Sending Slack alert"

+ 2 - 2
lgsm/functions/alert_telegram.sh

@@ -6,7 +6,7 @@
 
 local commandname="ALERT"
 local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 json=$(cat <<EOF
 {
@@ -18,7 +18,7 @@ EOF
 )
 
 fn_print_dots "Sending Telegram alert"
-telegramsend=$(${curlpath} -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.telegram.org/bot${telegramtoken}/sendMessage" "${curlcustomstring}" | grep "error_code")
+telegramsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.telegram.org/bot${telegramtoken}/sendMessage" "${curlcustomstring}" | grep "error_code")
 
 if [ -n "${telegramsend}" ]; then
 	fn_print_fail_nl "Sending Telegram alert: ${telegramsend}"

+ 1 - 1
lgsm/functions/check_config.sh

@@ -5,7 +5,7 @@
 # Description: Checks if the server config is missing and warns the user if needed.
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ ! -e "${servercfgfullpath}" ]; then
 	if [ "${shortname}" != "hw" ]&&[ "${shortname}" != "ut3" ]&&[ "${shortname}" != "kf2" ]; then

+ 4 - 4
lgsm/functions/check_deps.sh

@@ -160,7 +160,7 @@ fn_deps_detector(){
 		depstatus=1
 		jquniversemissing=1
 	elif [ "${deptocheck}" == "mono-complete" ]; then
-		if [ "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then
+		if [ -n "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then
 			# Mono >= 5.0.0 already installed.
 			depstatus=0
 		else
@@ -337,7 +337,7 @@ fn_deps_build_debian(){
 	# LinuxGSM requirements.
 	array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python3 tar bzip2 gzip unzip binutils bc jq )
 
-	if [ "$(command -v tmux 2>/dev/null)" ]; then
+	if [ -n "$(command -v tmux 2>/dev/null)" ]; then
 		tmuxcheck=1 # Added for users compiling tmux from source to bypass check.
 	else
 		array_deps_required+=( tmux )
@@ -402,7 +402,7 @@ fn_deps_build_debian(){
 		array_deps_required+=( libstdc++5:i386 )
 	# Project Zomboid
 	elif [ "${shortname}" == "pz" ]; then
-		if [ -n "$(java -version 2>&1 | grep "version")" ]; then
+		if java -version 2>&1 | grep "version"; then
 			# Added for users using Oracle JRE to bypass the check.
 			javacheck=1
 			array_deps_required+=( rng-tools )
@@ -461,7 +461,7 @@ fn_deps_build_redhat(){
 	fi
 
 	# All servers except ts3 require tmux.
-	if [ "$(command -v tmux 2>/dev/null)" ]; then
+	if [ -n "$(command -v tmux 2>/dev/null)" ]; then
 		# Added for users compiling tmux from source to bypass check.
 		tmuxcheck=1
 	else

+ 1 - 1
lgsm/functions/check_executable.sh

@@ -5,7 +5,7 @@
 # Description: Checks if server executable exists.
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Check if executable exists
 if [ ! -f "${executabledir}/${execname}" ]; then

+ 1 - 1
lgsm/functions/check_logs.sh

@@ -5,7 +5,7 @@
 # Description: Checks if log files exist.
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_check_logs(){
 	fn_print_dots "Checking for log files"

+ 5 - 6
lgsm/functions/check_permissions.sh

@@ -74,7 +74,7 @@ fn_check_permissions(){
 	# Check rootdir permissions.
 	if [ -n "${rootdir}" ]; then
 		# Get permission numbers on directory under the form 775.
-		rootdirperm="$(stat -c %a "${rootdir}")"
+		rootdirperm=$(stat -c %a "${rootdir}")
 		# Grab the first and second digit for user and group permission.
 		userrootdirperm="${rootdirperm:0:1}"
 		grouprootdirperm="${rootdirperm:1:1}"
@@ -94,10 +94,10 @@ fn_check_permissions(){
 	fi
 	# Check if executable is executable and attempt to fix it.
 	# First get executable name.
-	execname="$(basename "${executable}")"
+	execname=$(basename "${executable}")
 	if [ -f "${executabledir}/${execname}" ]; then
 		# Get permission numbers on file under the form 775.
-		execperm="$(stat -c %a "${executabledir}/${execname}")"
+		execperm=$(stat -c %a "${executabledir}/${execname}")
 		# Grab the first and second digit for user and group permission.
 		userexecperm="${execperm:0:1}"
 		groupexecperm="${execperm:1:1}"
@@ -118,7 +118,7 @@ fn_check_permissions(){
 				chmod u+x,g+x "${executabledir}/${execname}"
 				# Second check to see if it's been successfully applied.
 				# Get permission numbers on file under the form 775.
-				execperm="$(stat -c %a "${executabledir}/${execname}")"
+				execperm=$(stat -c %a "${executabledir}/${execname}")
 				# Grab the first and second digit for user and group permission.
 				userexecperm="${execperm:0:1}"
 				groupexecperm="${execperm:1:1}"
@@ -181,8 +181,7 @@ fn_sys_perm_fix_manually_msg(){
 
 # Attempt to fix /sys related permission errors if sudo is available, exits otherwise.
 fn_sys_perm_errors_fix(){
-	sudo -n true > /dev/null 2>&1
-	if [ $? -eq 0 ]; then
+	if sudo -n true > /dev/null 2>&1; then
 		fn_print_dots "Automatically fixing /sys permissions"
 		fn_script_log_info "Automatically fixing /sys permissions."
 		if [ "${sysdirpermerror}" == "1" ]; then

+ 1 - 1
lgsm/functions/check_root.sh

@@ -5,7 +5,7 @@
 # Description: Checks if the user tried to run the script as root.
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ "$(whoami)" = "root" ]; then
 	if [ "${function_selfname}" != "command_install.sh" ]; then

+ 1 - 1
lgsm/functions/check_status.sh

@@ -6,6 +6,6 @@
 # Description: Checks the process status of the server. Either online or offline.
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 status=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | grep -Ecx "^${selfname}")

+ 1 - 1
lgsm/functions/check_system_dir.sh

@@ -5,7 +5,7 @@
 # Description: Checks if systemdir/serverfiles is accessible.
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ "${function_selfname}" != "command_validate.sh" ]; then
 	checkdir="${serverfiles}"

+ 1 - 1
lgsm/functions/check_system_requirements.sh

@@ -6,7 +6,7 @@
 # Description: Checks RAM requirements
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 info_distro.sh
 

+ 1 - 1
lgsm/functions/command_backup.sh

@@ -7,7 +7,7 @@
 
 local commandname="BACKUP"
 local commandaction="Backup"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 

+ 1 - 1
lgsm/functions/command_console.sh

@@ -6,7 +6,7 @@
 
 local commandname="CONSOLE"
 local commandaction="Console"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 fn_print_header

+ 1 - 1
lgsm/functions/command_debug.sh

@@ -6,7 +6,7 @@
 
 local commandname="DEBUG"
 local commandaction="Debug"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Trap to remove lockfile on quit.
 fn_lockfile_trap(){

+ 1 - 1
lgsm/functions/command_details.sh

@@ -7,7 +7,7 @@
 
 local commandname="DETAILS"
 local commandaction="Details"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Run checks and gathers details to display.
 check.sh

+ 1 - 1
lgsm/functions/command_dev_debug.sh

@@ -6,7 +6,7 @@
 
 local commandname="DEV-DEBUG"
 local commandaction="Dev-Debug"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ -f "${rootdir}/.dev-debug" ]; then
 	rm "${rootdir}/.dev-debug"

+ 3 - 3
lgsm/functions/command_dev_detect_deps.sh

@@ -6,16 +6,16 @@
 
 local commandname="DETECT-DEPS"
 local commandaction="Detect-Deps"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e "================================="
 echo -e "Dependencies Checker"
 echo -e "================================="
 echo -e "Checking directory: "
 echo -e "${serverfiles}"
-if [ "$(command -v eu-readelf 2>/dev/null)" ]; then
+if [ -n "$(command -v eu-readelf 2>/dev/null)" ]; then
 	readelf=eu-readelf
-elif [ "$(command -v readelf 2>/dev/null)" ]; then
+elif [ -n "$(command -v readelf 2>/dev/null)" ]; then
 	readelf=readelf
 else
 	echo -e "readelf/eu-readelf not installed"

+ 2 - 2
lgsm/functions/command_dev_detect_glibc.sh

@@ -7,7 +7,7 @@
 
 local commandname="DETECT-GLIBC"
 local commandaction="Detect-Glibc"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e "================================="
 echo -e "glibc Requirements Checker"
@@ -20,7 +20,7 @@ if [ -z "$(command -v objdump)" ]; then
 fi
 
 if [ -z "${serverfiles}" ]; then
-	dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
+	dir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
 fi
 
 if [ -d "${serverfiles}" ]; then

+ 2 - 2
lgsm/functions/command_dev_detect_ldd.sh

@@ -7,14 +7,14 @@
 
 local commandname="DETECT-LDD"
 local commandaction="Detect-LDD"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e "================================="
 echo -e "Shared Object dependencies Checker"
 echo -e "================================="
 
 if [ -z "${serverfiles}" ]; then
-	dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
+	dir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
 fi
 
 if [ -d "${serverfiles}" ]; then

+ 1 - 1
lgsm/functions/command_dev_query_raw.sh

@@ -6,7 +6,7 @@
 
 local commandname="QUERY-RAW"
 local commandaction="Query Raw"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "Query Port - Raw Output"

+ 1 - 1
lgsm/functions/command_donate.sh

@@ -6,7 +6,7 @@
 
 local commandname="CONSOLE"
 local commandaction="Console"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_ascii_logo
 echo -e "${lightyellow}Support LinuxGSM${default}"

+ 9 - 9
lgsm/functions/command_fastdl.sh

@@ -7,7 +7,7 @@
 
 local commandname="FASTDL"
 local commandaction="FastDL"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 
@@ -135,7 +135,7 @@ fn_human_readable_file_size(){
 			local factor="${item%:*}"
 			local abbrev="${item#*:}"
 			if [[ "${bytes}" -ge "${factor}" ]]; then
-				local size="$(bc -l <<< "${bytes} / ${factor}")"
+				local size=$(bc -l <<< "${bytes} / ${factor}")
 				printf "%.*f %s\n" "${precision}" "${size}" "${abbrev}"
 				break
 			fi
@@ -161,9 +161,9 @@ fn_fastdl_preview(){
 			while read -r ext; do
 				((fileswc++))
 				tput rc; tput el
-				printf "gathering ${allowed_extention} : ${fileswc}..."
+				echo -e "gathering ${allowed_extention} : ${fileswc}..."
 				echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
-			done < <(find . -type f -iname ${allowed_extention})
+			done < <(find . -type f -iname "${allowed_extention}")
 			if [ ${fileswc} != 0 ]; then
 				fn_print_ok_eol_nl
 			else
@@ -192,7 +192,7 @@ fn_fastdl_preview(){
 					while read -r ext; do
 						((fileswc++))
 						tput rc; tput el
-						printf "gathering ${directory} ${allowed_extention} : ${fileswc}..."
+						echo -e "gathering ${directory} ${allowed_extention} : ${fileswc}..."
 						echo -e "${ext}" >> "${tmpdir}/fastdl_files_to_compress.txt"
 					done < <(find "${systemdir}/${directory}" -type f -iname ${allowed_extention})
 					tput rc; tput el
@@ -305,9 +305,9 @@ fn_fastdl_gmod(){
 	if [ -f "${tmpdir}/fastdl_files_to_compress.txt" ]; then
 		totalfiles=$(wc -l < "${tmpdir}/fastdl_files_to_compress.txt")
 		# Calculates total file size.
-		while read dufile; do
+		while read -r dufile; do
 			filesize=$(du -b "${dufile}" | awk '{ print $1 }')
-			filesizetotal=$(( ${filesizetotal} + ${filesize} ))
+			filesizetotal=$((filesizetotal + filesize))
 		done <"${tmpdir}/fastdl_files_to_compress.txt"
 	fi
 }
@@ -334,7 +334,7 @@ fn_fastdl_source(){
 				while read -r fastdlfile; do
 					((fileswc++))
 					tput rc; tput el
-					printf "copying ${directory} ${allowed_extention} : ${fileswc}..."
+					echo -e "copying ${directory} ${allowed_extention} : ${fileswc}..."
 					fn_sleep_time
 					# get relative path of file in the dir
 					tmprelfilepath="${fastdlfile#"${systemdir}/"}"
@@ -352,7 +352,7 @@ fn_fastdl_source(){
 					else
 						fn_script_log_pass "Copying ${fastdlfile} > ${fastdldir}/${copytodir}"
 					fi
-				done < <(find "${systemdir}/${directory}" -type f -iname ${allowed_extention})
+				done < <(find "${systemdir}/${directory}" -type f -iname "${allowed_extention}")
 				if [ ${fileswc} != 0 ]; then
 					fn_print_ok_eol_nl
 				fi

+ 1 - 1
lgsm/functions/command_install.sh

@@ -7,7 +7,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 if [ "$(whoami)" = "root" ]; then

+ 1 - 1
lgsm/functions/command_install_resources_mta.sh

@@ -6,7 +6,7 @@
 
 local commandname="DEFAULT_RESOURCES"
 local commandaction="Default Resources"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_install_resources(){
 	echo -e ""

+ 1 - 1
lgsm/functions/command_mods_install.sh

@@ -7,7 +7,7 @@
 
 local commandname="MODS"
 local commandaction="addons/mods"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 mods_core.sh

+ 2 - 2
lgsm/functions/command_mods_remove.sh

@@ -7,7 +7,7 @@
 
 local commandname="MODS"
 local commandaction="Mods Remove"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 mods_core.sh
@@ -64,7 +64,7 @@ modfileline="1"
 tput sc
 while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
 	# Current line defines current file to remove.
-	currentfileremove="$(sed "${modfileline}q;d" "${modsdir}/${modcommand}-files.txt")"
+	currentfileremove=$(sed "${modfileline}q;d" "${modsdir}/${modcommand}-files.txt")
 	# If file or directory exists, then remove it.
 
 	if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then

+ 5 - 5
lgsm/functions/command_mods_update.sh

@@ -7,7 +7,7 @@
 
 local commandname="MODS"
 local commandaction="Mods Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 mods_core.sh
@@ -19,11 +19,11 @@ fn_remove_cfg_files(){
 		echo -e "the following files/directories will be preserved:"
 		fn_sleep_time
 		# Count how many files there are to remove.
-		filestopreserve="$(echo -e "${modkeepfiles}" | awk -F ';' '{ print NF }')"
+		filestopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' '{ print NF }')
 		# Test all subvalues of "modkeepfiles" using the ";" separator.
-		for ((preservefilesindex=1; preservefilesindex < ${filestopreserve}; preservefilesindex++)); do
+		for ((preservefilesindex=1; preservefilesindex < filestopreserve; preservefilesindex++)); do
 			# Put the current file we are looking for into a variable.
-			filetopreserve="$(echo -e "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }' )"
+			filetopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }' )
 			echo -e "	* serverfiles/${filetopreserve}"
 			# If it matches an existing file that have been extracted delete the file.
 			if [ -f "${extractdir}/${filetopreserve}" ]||[ -d "${extractdir}/${filetopreserve}" ]; then
@@ -71,7 +71,7 @@ done
 # Reset line value.
 installedmodsline="1"
 while [ "${installedmodsline}" -le "${installedmodscount}" ]; do
-	currentmod="$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")"
+	currentmod=$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")
 	if [ -n "${currentmod}" ]; then
 		fn_mod_get_info
 		# Don not update mod if the policy is set to "NOUPDATE".

+ 2 - 2
lgsm/functions/command_monitor.sh

@@ -8,7 +8,7 @@
 
 local commandname="MONITOR"
 local commandaction="Monitor"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_monitor_check_lockfile(){
 	# Monitor does not run it lockfile is not found.
@@ -211,7 +211,7 @@ fn_monitor_loop(){
 	do
 		# Will check if gamedig is installed and bypass if not.
 		if [ "${querymethod}" == "gamedig" ]; then
-			if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then
+			if [ -n "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then
 				if [ -z "${monitorpass}" ]; then
 					fn_monitor_query
 				fi

+ 4 - 4
lgsm/functions/command_postdetails.sh

@@ -7,7 +7,7 @@
 
 local commandname="POSTDETAILS"
 local commandaction="Postdetails"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Set posttarget to the appropriately-defined post destination.
 
@@ -80,12 +80,12 @@ fi
 if [ "${posttarget}" == "http://pastebin.com" ] ; then
 	fn_print_dots "Posting details to pastbin.com for ${postexpire}"
 	# grab the return from 'value' from an initial visit to pastebin.
-	csrftoken=$(${curlpath} -s "${posttarget}" |
+	csrftoken=$(curl -s "${posttarget}" |
 					sed -n 's/^.*input type="hidden" name="csrf_token_post" value="\(.*\)".*$/\1/p')
 	#
 	# Use the csrftoken to then post the content.
 	#
-	link=$(${curlpath} -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \
+	link=$(curl -s "${posttarget}/post.php" -D - -F "submit_hidden=submit_hidden" \
 				-F "post_key=${csrftoken}" -F "paste_expire_date=${postexpire}" \
 				-F "paste_name=${gamename} Debug Info" \
 				-F "paste_format=8" -F "paste_private=0" \
@@ -101,7 +101,7 @@ elif [ "${posttarget}" == "https://hastebin.com" ] ; then
 	# hastebin is a bit simpler.  If successful, the returned result
 	# should look like: {"something":"key"}, putting the reference that
 	# we need in "key".  TODO - error handling. -CedarLUG
-	link=$(${curlpath} -H "HTTP_X_REQUESTED_WITH:XMLHttpRequest" -s -d "$(<${postdetailslog})" "${posttarget}/documents" | cut -d\" -f4)
+	link=$(curl -H "HTTP_X_REQUESTED_WITH:XMLHttpRequest" -s -d "$(<${postdetailslog})" "${posttarget}/documents" | cut -d\" -f4)
 	fn_print_ok_nl "Posting details to hastebin.com for ${postexpire}"
 	pdurl="${posttarget}/${link}"
 	echo -e "Please share the following url for support: ${pdurl}"

+ 1 - 1
lgsm/functions/command_restart.sh

@@ -6,7 +6,7 @@
 
 local commandname="RESTART"
 local commandaction="Restarting"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 info_config.sh
 exitbypass=1

+ 4 - 4
lgsm/functions/command_start.sh

@@ -7,7 +7,7 @@
 
 local commandname="START"
 local commandaction="Starting"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_start_teamspeak3(){
 	if [ ! -e "${servercfgfullpath}" ]; then
@@ -70,7 +70,7 @@ fn_start_tmux(){
 	touch "${consolelog}"
 
 	# Get tmux version.
-	tmuxversion="$(tmux -V | sed "s/tmux //" | sed -n '1 p')"
+	tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p')
 	# Tmux compiled from source will return "master", therefore ignore it.
 	if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p')" == "master" ]; then
 		fn_script_log "Tmux version: master (user compiled)"
@@ -80,7 +80,7 @@ fn_start_tmux(){
 		fi
 	elif [ -n "${tmuxversion}" ]; then
 		# Get the digit version of tmux.
-		tmuxversion="$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')"
+		tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')
 		# tmux pipe-pane not supported in tmux versions < 1.6.
 		if [ "${tmuxversion}" -lt "16" ]; then
 			echo -e "Console logging disabled: Tmux => 1.6 required
@@ -131,7 +131,7 @@ fn_sleep_time
 			echo -e ""
 			echo -e "Fix"
 			echo -e "================================="
-				if [ ! "$(grep "tty:" /etc/group|grep "$(whoami)")" ]; then
+				if ! grep "tty:" /etc/group | grep "$(whoami)"; then
 					echo -e "$(whoami) is not part of the tty group."
 					fn_script_log_info "$(whoami) is not part of the tty group."
 					group=$(grep tty /etc/group)

+ 2 - 2
lgsm/functions/command_stop.sh

@@ -7,7 +7,7 @@
 
 local commandname="STOP"
 local commandaction="Stopping"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Attempts graceful shutdown by sending 'CTRL+c'.
 fn_stop_graceful_ctrlc(){
@@ -126,7 +126,7 @@ fn_stop_graceful_sdtd(){
 	fn_script_log_info "Graceful: telnet"
 	if [ "${telnetenabled}" == "false" ]; then
 		fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}"
-	elif [ "$(command -v expect 2>/dev/null)" ]; then
+	elif [ -n "$(command -v expect 2>/dev/null)" ]; 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}:${telnetport}"

+ 1 - 1
lgsm/functions/command_test_alert.sh

@@ -6,7 +6,7 @@
 
 local commandname="ALERT"
 local commandaction="Alert"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_dots "${servername}"
 check.sh

+ 1 - 1
lgsm/functions/command_ts3_server_pass.sh

@@ -7,7 +7,7 @@
 
 local commandname="PASSWORD-CHANGE"
 local commandaction="Password Change"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_serveradmin_password_prompt(){
 	fn_print_header

+ 1 - 1
lgsm/functions/command_update.sh

@@ -6,7 +6,7 @@
 
 local commandname="UPDATE"
 local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_dots ""
 check.sh

+ 1 - 1
lgsm/functions/command_update_functions.sh

@@ -6,7 +6,7 @@
 # Legacy Command
 
 command_update_linuxgsm.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 

+ 9 - 8
lgsm/functions/command_update_linuxgsm.sh

@@ -6,7 +6,7 @@
 
 local commandname="UPDATE LINUXGSM"
 local commandaction="Update LinuxGSM"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_dots "Updating LinuxGSM"
 check.sh
@@ -16,7 +16,7 @@ echo -en "\n"
 if [ -z "${legacymode}" ]; then
 	# Check and update _default.cfg.
 	echo -en "    checking config _default.cfg...\c"
-	config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
+	config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
 	if [ "${config_file_diff}" != "" ]; then
 		fn_print_update_eol_nl
 		fn_script_log_info "checking config _default.cfg: UPDATE"
@@ -30,7 +30,7 @@ if [ -z "${legacymode}" ]; then
 	fi
 
 	echo -en "    checking linuxgsm.sh...\c"
-	tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(${curlpath} -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh"))
+	tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh"))
 	if [ "${tmp_script_diff}" != "" ]; then
 		fn_print_update_eol_nl
 		fn_script_log_info "checking linuxgsm.sh: UPDATE"
@@ -56,11 +56,13 @@ if [ -z "${legacymode}" ]; then
 			echo -e "	Backup: ${backupdir}/script/${selfname}-$(date +"%m_%d_%Y_%M").bak"
 		fi
 		echo -en "    fetching ${selfname}...\c"
+		exitcode=$?
 		cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}"
 		sed -i "s/shortname=\"core\"/shortname=\"${shortname}\"/g" "${rootdir}/${selfname}"
 		sed -i "s/gameservername=\"core\"/gameservername=\"${gameservername}\"/g" "${rootdir}/${selfname}"
 		sed -i "s/gamename=\"core\"/gamename=\"${gamename}\"/g" "${rootdir}/${selfname}"
-		if [ $? -ne 0 ]; then
+
+		if [ "${exitcode}" == "0" ]; then
 			fn_print_fail_eol_nl
 			core_exit.sh
 		else
@@ -79,15 +81,14 @@ if [ -n "${functionsdir}" ]; then
 		do
 			echo -en "    checking function ${functionfile}...\c"
 			github_file_url_dir="lgsm/functions"
-			get_function_file=$(${curlpath} --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}")
+			get_function_file=$(curl --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}")
 			exitcode=$?
-			function_file_diff=$(diff "${functionsdir}/${functionfile}" <(${curlpath} --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"))
+			function_file_diff=$(diff "${functionsdir}/${functionfile}" <(curl --fail -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${functionfile}"))
 			if [ ${exitcode} -ne 0 ]; then
 				fn_print_fail_eol_nl
 				echo -en "    removing unknown function ${functionfile}...\c"
 				fn_script_log_fatal "removing unknown function ${functionfile}"
-				rm -f "${functionfile}"
-				if [ $? -ne 0 ]; then
+				if ! rm -f "${functionfile}"; then
 					fn_print_fail_eol_nl
 					core_exit.sh
 				else

+ 2 - 2
lgsm/functions/command_validate.sh

@@ -6,7 +6,7 @@
 
 local commandname="VALIDATE"
 local commandaction="Validate"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_validation(){
 	fn_print_info "Validating files: SteamCMD"
@@ -18,7 +18,7 @@ fn_validation(){
 	cd "${steamcmddir}" || exit
 	# Detects if unbuffer command is available for 32 bit distributions only.
 	info_distro.sh
-	if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
+	if [ -n "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
 		unbuffer="stdbuf -i0 -o0 -e0"
 	fi
 

+ 1 - 1
lgsm/functions/command_wipe.sh

@@ -7,7 +7,7 @@
 
 local commandname="WIPE"
 local commandaction="Wipe"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 fn_print_header

+ 1 - 1
lgsm/functions/compress_unreal2_maps.sh

@@ -5,7 +5,7 @@
 # Description: Compresses unreal maps.
 
 local commandaction="Unreal Map Compressor"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 fn_print_header

+ 1 - 1
lgsm/functions/compress_ut99_maps.sh

@@ -5,7 +5,7 @@
 # Description: Compresses unreal maps.
 
 local commandaction="Unreal Map Compressor"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 check.sh
 fn_print_header

+ 6 - 8
lgsm/functions/core_dl.sh

@@ -19,7 +19,7 @@
 
 local commandname="DOWNLOAD"
 local commandaction="Download"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Emptys contents of the LinuxGSM tmpdir.
 fn_clear_tmp(){
@@ -133,11 +133,11 @@ fn_fetch_file(){
 			echo -en "downloading ${local_filename}..."
 			fn_sleep_time
 			echo -en "\033[1K"
-			curlcmd=$(${curlpath} --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}")
+			curlcmd=$(curl --progress-bar --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}")
 			echo -en "downloading ${local_filename}..."
 		else
 			echo -en "    fetching ${local_filename}...\c"
-			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+			curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 		fi
 		local exitcode=$?
 		if [ ${exitcode} -ne 0 ]; then
@@ -168,7 +168,7 @@ fn_fetch_file(){
 		fn_dl_md5
 		# Execute file if run is set.
 		if [ "${run}" == "run" ]; then
-      # shellcheck source=/dev/null
+			# shellcheck source=/dev/null
 			source "${local_filedir}/${local_filename}"
 		fi
 	fi
@@ -255,10 +255,8 @@ fn_update_function(){
 	fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${md5}"
 }
 
-# Defines curl path.
-curlpath=$(command -v curl 2>/dev/null)
-
-if [ "$(basename "${curlpath}")" != "curl" ]; then
+# Check that curl is installed
+if [ -z "$(command -v curl 2>/dev/null)" ]; then
 	echo -e "[ FAIL ] Curl is not installed"
 	exit 1
 fi

+ 125 - 125
lgsm/functions/core_functions.sh

@@ -8,7 +8,7 @@
 # Core
 
 core_dl.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
 	fn_fetch_core_dl "lgsm/functions" "core_dl.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 else
@@ -17,7 +17,7 @@ fi
 }
 
 core_messages.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
 	fn_fetch_core_dl "lgsm/functions" "core_messages.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 else
@@ -26,7 +26,7 @@ fi
 }
 
 core_legacy.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 if [ "$(type fn_fetch_core_dl 2>/dev/null)" ]; then
 	fn_fetch_core_dl "lgsm/functions" "core_legacy.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 else
@@ -35,538 +35,538 @@ fi
 }
 
 core_exit.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 core_getopt.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 core_trap.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Commands
 
 command_backup.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_console.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_debug.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_details.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_donate.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_postdetails.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_test_alert.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_monitor.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_start.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_stop.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_validate.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_install.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_install_resources_mta.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_squad_license.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_mods_install.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_mods_update.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_mods_remove.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_fastdl.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_ts3_server_pass.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_restart.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_wipe.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Checks
 
 check.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_config.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_deps.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_executable.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_glibc.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_ip.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_logs.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_permissions.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_root.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_status.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_steamcmd.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_system_dir.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_system_requirements.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 check_tmuxception.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Compress
 
 compress_unreal2_maps.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 compress_ut99_maps.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Mods
 
 mods_list.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 mods_core.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Dev
 
 command_dev_clear_functions.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_dev_debug.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_dev_detect_deps.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_dev_detect_glibc.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_dev_detect_ldd.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_dev_query_raw.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Fix
 
 fix.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ark.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_arma3.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_csgo.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_dst.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ges.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ins.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_kf.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_kf2.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_mta.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ro.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_rust.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_rw.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_sfc.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_steamcmd.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_terraria.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_tf2.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ut3.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_rust.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_sdtd.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_sof2.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ss3.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ts3.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ut2k4.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_ut.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_unt.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_wurm.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fix_zmr.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Info
 
 info_stats.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 info_config.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 info_distro.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 info_gamedig.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 info_messages.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 info_parms.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Alert
 
 alert.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_discord.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_email.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_ifttt.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_mailgun.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_pushbullet.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_pushover.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_telegram.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 alert_slack.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 # Logs
 
 logs.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Query
 
 query_gamedig.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 # Update
 
 command_update_functions.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_update_linuxgsm.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 command_update.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 update_ts3.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 update_minecraft.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 update_mumble.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 update_mta.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 update_factorio.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 update_steamcmd.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 fn_update_functions.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
@@ -580,96 +580,96 @@ command_install.sh
 }
 
 install_complete.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_config.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_factorio_save.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_dst_token.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_eula.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_gsquery.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_gslt.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_header.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_logs.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_retry.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_server_dir.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 install_server_files.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_stats.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_steamcmd.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_ts3.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_ts3db.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_ut2k4.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_dl_ut2k4.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
 install_ut2k4_key.sh(){
-functionfile="${FUNCNAME}"
+functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 

+ 5 - 5
lgsm/functions/core_getopt.sh

@@ -4,7 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: getopt arguments.
 
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 ### Define all commands here.
 ## User commands | Trigger commands | Description
@@ -143,8 +143,8 @@ currentopt+=( "${cmd_donate[@]}" )
 optcommands=()
 index="0"
 for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
-	cmdamount="$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')"
-	for ((cmdindex=1; cmdindex <= ${cmdamount}; cmdindex++)); do
+	cmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
+	for ((cmdindex=1; cmdindex <= cmdamount; cmdindex++)); do
 		optcommands+=( "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')" )
 	done
 done
@@ -180,8 +180,8 @@ for i in "${optcommands[@]}"; do
 		# Seek and run command.
 		index="0"
 		for ((index="0"; index < ${#currentopt[@]}; index+=3)); do
-			currcmdamount="$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')"
-			for ((currcmdindex=1; currcmdindex <= ${currcmdamount}; currcmdindex++)); do
+			currcmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
+			for ((currcmdindex=1; currcmdindex <= currcmdamount; currcmdindex++)); do
 				if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
 					# Run command.
 					eval "${currentopt[index+1]}"

+ 1 - 1
lgsm/functions/fix_arma3.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Fixes: 20150 Segmentation fault (core dumped) error.
 if [ ! -d "${HOME}/.local/share/Arma 3" ]||[ ! -d "${HOME}/.local/share/Arma 3 - Other Profiles" ]; then

+ 1 - 1
lgsm/functions/fix_csgo.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Fixes: server not always creating steam_appid.txt file.
 if [ ! -f "${serverfiles}/steam_appid.txt" ]; then

+ 1 - 1
lgsm/functions/fix_dst.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # 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.

+ 1 - 1
lgsm/functions/fix_kf.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e "Applying WebAdmin ROOst.css fix."
 echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 1 - 1
lgsm/functions/fix_kf2.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_parms(){
 parms="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\""

+ 1 - 1
lgsm/functions/fix_mta.sh

@@ -6,7 +6,7 @@
 # Description: Installs the libmysqlclient for database functions on the server
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ ! -f "${lgsmdir}/lib/libmysqlclient.so.16" ]; then
 	fixname="libmysqlclient16"

+ 1 - 1
lgsm/functions/fix_ro.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e "Applying WebAdmin ROOst.css fix."
 echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 1 - 1
lgsm/functions/fix_sfc.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ ! -f "${serverfiles}/bin/datacache.so" ]; then
 	ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so"

+ 1 - 1
lgsm/functions/fix_ss3.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Fixes https://steamcommunity.com/app/41070/discussions/0/353916981477716386/
 if [ "$(diff "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Bin/steamclient.so" >/dev/null)" ]; then

+ 1 - 1
lgsm/functions/fix_steamcmd.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # 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

+ 1 - 1
lgsm/functions/fix_terraria.sh

@@ -6,6 +6,6 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 export TERM=xterm

+ 1 - 1
lgsm/functions/fix_tf2.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Fixes: Team Fortress 2 Segmentation fault for Red-Hat Distros #2062.
 if [ -f "/etc/redhat-release" ]&&[ ! -f "${serverfiles}/bin/libcurl-gnutls.so.4" ]; then

+ 1 - 1
lgsm/functions/fix_ts3.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Fixes: makes libmariadb2 available #1924.
 if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then

+ 1 - 1
lgsm/functions/fix_ut.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 #Set Binary Executable
 echo -e "chmod +x ${executabledir}/${executable}"

+ 1 - 1
lgsm/functions/fix_ut2k4.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e "applying WebAdmin ut2003.css fix."
 echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"

+ 1 - 1
lgsm/functions/fix_ut3.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_parms(){
 parms="server VCTF-Suspense?Game=UTGameContent.UTVehicleCTFGame_Content?bIsDedicated=true?bIsLanMatch=false?bUsesStats=false?bShouldAdvertise=false?PureServer=1?bAllowJoinInProgress=true?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}"

+ 1 - 1
lgsm/functions/fix_zmr.sh

@@ -6,7 +6,7 @@
 
 local commandname="FIX"
 local commandaction="Fix"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ ! -f "${serverfiles}/bin/datacache.so" ]; then
 	ln -s "${serverfiles}/bin/datacache_srv.so" "${serverfiles}/bin/datacache.so"

+ 8 - 8
lgsm/functions/info_config.sh

@@ -5,7 +5,7 @@
 # Website: https://linuxgsm.com
 # Description: Gets specific details from config files.
 
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 ## Examples of filtering to get info from config files.
 # sed 's/foo//g' - remove foo
@@ -413,9 +413,9 @@ fn_info_config_pstbs(){
 		maxplayers="${unavailable}"
 		reservedslots="${unavailable}"
 	else
-		servername="$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=";,:' | sed -e 's/^[ \t]//' -e 's/[ \t]*$//')"
-		maxplayers="$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')"
-		reservedslots="$(grep "NumReservedSlots=" "${servercfgfullpath}" | tr -cd '[:digit:]')"
+		servername=$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=";,:' | sed -e 's/^[ \t]//' -e 's/[ \t]*$//')
+		maxplayers=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')
+		reservedslots=$(grep "NumReservedSlots=" "${servercfgfullpath}" | tr -cd '[:digit:]')
 	fi
 
 	if [ ! -f "${servercfgdir}/Rcon.cfg" ]; then
@@ -684,8 +684,8 @@ fn_info_config_sbots(){
 		servername="${unavailable}"
 		maxplayers="${unavailable}"
 	else
-		servername="$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=";,:' | sed -e 's/^[ \t]//' -e 's/[ \t]*$//')"
-		maxplayers="$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')"
+		servername=$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=";,:' | sed -e 's/^[ \t]//' -e 's/[ \t]*$//')
+		maxplayers=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')
 	fi
 
 	servername=${servername:-"NOT SET"}
@@ -1225,8 +1225,8 @@ fn_info_config_squad(){
 		servername="${unavailable}"
 		maxplayers="${unavailable}"
 	else
-		servername="$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')"
-		maxplayers="$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')"
+		servername=$(grep "ServerName=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		maxplayers=$(grep "MaxPlayers=" "${servercfgfullpath}" | tr -cd '[:digit:]')
 	fi
 
 	if [ ! -f "${servercfgdir}/Rcon.cfg" ]; then

+ 17 - 17
lgsm/functions/info_distro.sh

@@ -5,7 +5,7 @@
 # Description: Variables providing useful info on the Operating System such as disk and performace info.
 # Used for command_details.sh, command_debug.sh and alert.sh.
 
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 ### Game Server pid
 if [ "${status}" == "1" ]; then
@@ -34,9 +34,9 @@ do
 		distrocodename=$(grep VERSION_CODENAME /etc/os-release | sed 's/VERSION_CODENAME=//g' | sed 's/\"//g')
 	elif [ -n "$(command -v lsb_release 2>/dev/null)" ]&&[ "${distro_info}" == "lsb_release" ]; then
 		if [ -z "${distroname}" ];then
-			distroname="$(lsb_release -sd)"
+			distroname=$(lsb_release -sd)
 		elif [ -z "${distroversion}" ];then
-			distroversion="$(lsb_release -sr)"
+			distroversion=$(lsb_release -sr)
 		elif [ -z "${distroid}" ];then
 			distroid=$(lsb_release -si)
 		elif [ -z "${distrocodename}" ];then
@@ -44,13 +44,13 @@ do
 		fi
 	elif [ -n "$(command -v hostnamectl 2>/dev/null)" ]&&[ "${distro_info}" == "hostnamectl" ]; then
 		if [ -z "${distroname}" ];then
-			distroname="$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g')"
+			distroname=$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g')
 		fi
 	elif [ -f "/etc/debian_version" ]&&[ "${distro_info}" == "debian_version" ]; then
 		if [ -z "${distroname}" ];then
 			distroname="Debian $(cat /etc/debian_version)"
 		elif [ -z "${distroversion}" ];then
-			distroversion="$(cat /etc/debian_version)"
+			distroversion=$(cat /etc/debian_version)
 		elif [ -z "${distroid}" ];then
 			distroid="debian"
 		fi
@@ -60,21 +60,21 @@ do
 		elif [ -z "${distroversion}" ];then
 			distroversion=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos|fedora" | cut -d"-" -f3)
 		elif [ -z "${distroid}" ];then
-			distroid="$(awk '{print $1}' /etc/redhat-release)"
+			distroid=$(awk '{print $1}' /etc/redhat-release)
 		fi
 	fi
 done
 
 ## Glibc version
 # e.g: 1.17
-glibcversion="$(ldd --version | sed -n '1s/.* //p')"
+glibcversion=$(ldd --version | sed -n '1s/.* //p')
 
 ## tmux version
 # e.g: tmux 1.6
 if [ -z "$(command -V tmux 2>/dev/null)" ]; then
 	tmuxv="${red}NOT INSTALLED!${default}"
 else
-	if [ "$(tmux -V|sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ] 2>/dev/null; then
+	if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then
 		tmuxv="$(tmux -V) (>= 1.6 required for console log)"
 	else
 		tmuxv=$(tmux -V)
@@ -107,7 +107,7 @@ fi
 # Available RAM and swap.
 
 # Newer distros can use numfmt to give more accurate results.
-if [ "$(command -v numfmt 2>/dev/null)" ]; then
+if [ -n "$(command -v numfmt 2>/dev/null)" ]; then
 	# Issue #2005 - Kernel 3.14+ contains MemAvailable which should be used. All others will be calculated.
 
 	# get the raw KB values of these fields.
@@ -121,16 +121,16 @@ if [ "$(command -v numfmt 2>/dev/null)" ]; then
 	if grep -q ^MemAvailable /proc/meminfo; then
 	    physmemactualfreekb=$(grep ^MemAvailable /proc/meminfo | awk '{print $2}')
 	else
-	    physmemactualfreekb=$((${physmemfreekb}+${physmembufferskb}+${physmemcachedkb}))
+	    physmemactualfreekb=$((physmemfreekb+physmembufferskb+physmemcachedkb))
 	fi
 
 	# Available RAM and swap.
-	physmemtotalmb=$((${physmemtotalkb}/1024))
+	physmemtotalmb=$((physmemtotalkb/1024))
 	physmemtotal=$(numfmt --to=iec --from=iec --suffix=B "${physmemtotalkb}K")
 	physmemfree=$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")
-	physmemused=$(numfmt --to=iec --from=iec --suffix=B "$((${physmemtotalkb}-${physmemfreekb}-${physmembufferskb}-${physmemcachedkb}-${physmemreclaimablekb}))K")
+	physmemused=$(numfmt --to=iec --from=iec --suffix=B "$((physmemtotalkb-physmemfreekb-physmembufferskb-physmemcachedkb-physmemreclaimablekb))K")
 	physmemavailable=$(numfmt --to=iec --from=iec --suffix=B "${physmemactualfreekb}K")
-	physmemcached=$(numfmt --to=iec --from=iec --suffix=B "$((${physmemcachedkb}+${physmemreclaimablekb}))K")
+	physmemcached=$(numfmt --to=iec --from=iec --suffix=B "$((physmemcachedkb+physmemreclaimablekb))K")
 
 	swaptotal=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapTotal /proc/meminfo | awk '{print $2}')K")
 	swapfree=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapFree /proc/meminfo | awk '{print $2}')K")
@@ -228,7 +228,7 @@ netlink=$(ethtool "${netint}" 2>/dev/null| grep Speed | awk '{print $2}')
 
 # External IP address
 if [ -z "${extip}" ]; then
-	extip=$(${curlpath} -4 -m 3 ifconfig.co 2>/dev/null)
+	extip=$(curl -4 -m 3 ifconfig.co 2>/dev/null)
 	exitcode=$?
 	# Should ifconfig.co return an error will use last known IP.
 	if [ ${exitcode} -eq 0 ]; then
@@ -252,12 +252,12 @@ else
 fi
 
 # Steam Master Server - checks if detected by master server.
-if [ "$(command -v jq 2>/dev/null)" ]; then
+if [ -n "$(command -v jq 2>/dev/null)" ]; then
 	if [ "${ip}" ]&&[ "${port}" ]; then
 		if [ "${steammaster}" == "true" ]; then
-			masterserver="$(${curlpath} -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)"
+			masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)
 			if [ "${masterserver}" == "0" ]; then
-				masterserver="$(${curlpath} -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)"
+				masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${extip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l)
 			fi
 			if [ "${masterserver}" == "0" ]; then
 				displaymasterserver="false"

+ 1 - 1
lgsm/functions/info_parms.sh

@@ -4,7 +4,7 @@
 # Website: https://linuxgsm.com
 # Description: If specific parms are not set then this will be displayed in details.
 
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 ## Examples of filtering to get info from config files
 # sed 's/foo//g' - remove foo

+ 4 - 4
lgsm/functions/info_stats.sh

@@ -10,7 +10,7 @@ info_distro.sh
 if [ ! -f "${datadir}/uuid.txt" ];then
 	mkdir -p "${datadir}"
 	touch "${datadir}/uuid.txt"
-	if [ "$(command -v uuidgen 2>/dev/null)" ]; then
+	if [ -n "$(command -v uuidgen 2>/dev/null)" ]; then
 		uuidgen > "${datadir}/uuid.txt"
 	else
 		cat /proc/sys/kernel/random/uuid > "${datadir}/uuid.txt"
@@ -20,11 +20,11 @@ fi
 uuid=$(cat "${datadir}/uuid.txt")
 # results are rounded up to reduce number of different results in analytics
 # nearest 100Mhz
-cpuusedmhzroundup=$(((${cpuusedmhz} + 99) / 100 * 100))
+cpuusedmhzroundup=$(((cpuusedmhz + 99) / 100 * 100))
 # nearest 100MB
-memusedroundup=$(((${memused} + 99) / 100 * 100))
+memusedroundup=$(((memused + 99) / 100 * 100))
 # nearest 100MB
-serverfilesduroundup=$(((${serverfilesdu} + 99) / 100 * 100))
+serverfilesduroundup=$(((serverfilesdu + 99) / 100 * 100))
 # https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
 
 # Level 1 Stats

+ 1 - 1
lgsm/functions/install_complete.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "================================="

+ 1 - 1
lgsm/functions/install_config.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Checks if server cfg dir exists, creates it if it doesn't.
 fn_check_cfgdir(){

+ 1 - 1
lgsm/functions/install_dst_token.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "${lightyellow}Enter ${gamename} Cluster Token${default}"

+ 1 - 1
lgsm/functions/install_gslt.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "${lightyellow}Game Server Login Token${default}"

+ 1 - 1
lgsm/functions/install_header.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 clear
 fn_print_ascii_logo

+ 5 - 9
lgsm/functions/install_logs.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if [ "${checklogs}" != "1" ]; then
 	echo -e ""
@@ -51,8 +51,7 @@ if [ -n "${consolelogdir}" ]; then
 		fn_print_ok_eol_nl
 	fi
 	echo -en "creating console log: ${consolelog}..."
-	touch "${consolelog}"
-	if [ $? -ne 0 ]; then
+	if ! touch "${consolelog}"; then
 		fn_print_fail_eol_nl
 		core_exit.sh
 	else
@@ -63,8 +62,7 @@ fi
 # Create Game logs.
 if [ -n "${gamelogdir}" ]&&[ ! -d "${gamelogdir}" ]; then
 	echo -en "installing game log dir: ${gamelogdir}..."
-	mkdir -p "${gamelogdir}"
-	if [ $? -ne 0 ]; then
+	if ! mkdir -p "${gamelogdir}"; then
 		fn_print_fail_eol_nl
 		core_exit.sh
 	else
@@ -79,8 +77,7 @@ fi
 if [ -n "${gamelogdir}" ]; then
 	if [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ]; then
 		echo -en "creating symlink to game log dir: ${logdir}/server -> ${gamelogdir}..."
-		ln -nfs "${gamelogdir}" "${logdir}/server"
-		if [ $? -ne 0 ]; then
+		if ! ln -nfs "${gamelogdir}" "${logdir}/server"; then
 			fn_print_fail_eol_nl
 			core_exit.sh
 		else
@@ -93,8 +90,7 @@ fi
 if [ -d "${rootdir}/Steam/logs" ]; then
 	if [ ! -L "${logdir}/steamcmd" ]; then
 		echo -en "creating symlink to steam log dir: ${logdir}/steamcmd -> ${rootdir}/Steam/logs..."
-		ln -nfs "${rootdir}/Steam/logs" "${logdir}/steamcmd"
-		if [ $? -ne 0 ]; then
+		if ! ln -nfs "${rootdir}/Steam/logs" "${logdir}/steamcmd"; then
 			fn_print_fail_eol_nl
 			core_exit.sh
 		else

+ 1 - 1
lgsm/functions/install_mta_resources.sh

@@ -7,7 +7,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_print_information_nl "${gamename} will not function without resources!"
 echo -e "	* install default resources using ./${selfname} install-default-resources"

+ 1 - 1
lgsm/functions/install_retry.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 if fn_prompt_yn "Retry install?" Y; then
 	command_install.sh; core_exit.sh

+ 1 - 1
lgsm/functions/install_server_dir.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "${lightyellow}Server Directory${default}"

+ 2 - 2
lgsm/functions/install_server_files.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_install_server_files(){
     if [ "${shortname}" == "ahl" ]; then
@@ -98,7 +98,7 @@ fn_install_server_files_steamcmd(){
 
 			# Detects if unbuffer command is available for 32 bit distributions only.
 			info_distro.sh
-			if [ "$(command -v stdbuf 2>/dev/null)" ]&&[ "${arch}" != "x86_64" ]; then
+			if [ -n "$(command -v stdbuf 2>/dev/null)" ]&&[ "${arch}" != "x86_64" ]; then
 				unbuffer="stdbuf -i0 -o0 -e0"
 			fi
 

+ 1 - 1
lgsm/functions/install_squad_license.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "${lightyellow}Squad Server License${default}"

+ 1 - 1
lgsm/functions/install_stats.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "${lightyellow}LinuxGSM Stats${default}"

+ 1 - 1
lgsm/functions/install_ts3db.sh

@@ -7,7 +7,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_install_ts3db_mariadb(){
 	if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then

+ 1 - 1
lgsm/functions/install_ut2k4_key.sh

@@ -6,7 +6,7 @@
 
 local commandname="INSTALL"
 local commandaction="Install"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 echo -e ""
 echo -e "${lightyellow}Enter ${gamename} CD Key${default}"

+ 1 - 1
lgsm/functions/logs.sh

@@ -98,7 +98,7 @@ if [ "$(find "${lgsmlogdir}"/ -type f -mtime +"${logdays}" | wc -l)" -ne "0" ];
 	fi
 
 	# Count total amount of files removed.
-	countlogs=$((${scriptcount} + ${consolecount} + ${gamecount} + ${srcdscount} + ${smcount} + ${ulxcount} + ${darkrpcount}))
+	countlogs=$((scriptcount + consolecount + gamecount + srcdscount + smcount + ulxcount + darkrpcount))
 	# Job done.
 	fn_print_ok_nl "Removed ${countlogs} log files"
 	fn_script_log "Removed ${countlogs} log files"

+ 13 - 13
lgsm/functions/mods_core.sh

@@ -7,7 +7,7 @@
 
 local commandname="MODS"
 local commandaction="Mods"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Files and Directories.
 modsdir="${lgsmdir}/mods"
@@ -43,7 +43,7 @@ fn_mod_lowercase(){
 		fileswc=$(find "${extractdir}" -depth | wc -l)
 		echo -en "\r"
 		while read -r src; do
-			dst="$(dirname "${src}$(/)basename" "${src}" | tr 'A-Z' 'a-z')"
+			dst=$(dirname "${src}$(/)basename" "${src}" | tr '[:upper:]' '[:lower:]')
 			if [ "${src}" != "${dst}" ]
 			then
 				[ ! -e "${dst}" ] && mv -T "${src}" "${dst}" || echo -e "${src} was not renamed"
@@ -122,11 +122,11 @@ fn_mod_tidy_files_list(){
 	removefromlist="cfg;addons;RustDedicated_Data;RustDedicated_Data\/Managed;RustDedicated_Data\/Managed\/x86;RustDedicated_Data\/Managed\/x64;"
 	# Loop through files to remove from file list,
 	# generate elements to remove from list.
-	removefromlistamount="$(echo -e "${removefromlist}" | awk -F ';' '{ print NF }')"
+	removefromlistamount=$(echo -e "${removefromlist}" | awk -F ';' '{ print NF }')
 	# Test all subvalue of "removefromlist" using the ";" separator.
 	for ((filesindex=1; filesindex < removefromlistamount; filesindex++)); do
 		# Put current file into test variable.
-		removefilevar="$(echo -e "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }')"
+		removefilevar=$(echo -e "${removefromlist}" | awk -F ';' -v x=${filesindex} '{ print $x }')
 		# Delete line(s) matching exactly.
 		sed -i "/^${removefilevar}$/d" "${modsdir}/${modcommand}-files.txt"
 		# Exit on error.
@@ -259,7 +259,7 @@ fn_mods_installed_list(){
 	modcommandmaxlength="0"
 	# Loop through every line of the installed mods list ${modsinstalledlistfullpath}.
 	while [ "${installedmodsline}" -le "${installedmodscount}" ]; do
-		currentmod="$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")"
+		currentmod=$(sed "${installedmodsline}q;d" "${modsinstalledlistfullpath}")
 		# Get mod info to make sure mod exists.
 		fn_mod_get_info
 		# Add the mod to available commands.
@@ -306,11 +306,11 @@ fn_compatible_mod_games(){
 	# If value is set to GAMES (ignore).
 	if [ "${modgames}" != "GAMES" ]; then
 		# How many games we need to test.
-		gamesamount="$(echo -e "${modgames}" | awk -F ';' '{ print NF }')"
+		gamesamount=$(echo -e "${modgames}" | awk -F ';' '{ print NF }')
 		# Test all subvalue of "modgames" using the ";" separator.
 		for ((gamevarindex=1; gamevarindex < gamesamount; gamevarindex++)); do
 			# Put current game name into modtest variable.
-			gamemodtest="$( echo -e "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
+			gamemodtest=$( echo -e "${modgames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )
 			# If game name matches.
 			if [ "${gamemodtest}" == "${gamename}" ]; then
 				# Mod is compatible.
@@ -327,11 +327,11 @@ fn_compatible_mod_engines(){
 	# If value is set to ENGINES (ignore).
 	if [ "${modengines}" != "ENGINES" ]; then
 		# How many engines we need to test.
-		enginesamount="$(echo -e "${modengines}" | awk -F ';' '{ print NF }')"
+		enginesamount=$(echo -e "${modengines}" | awk -F ';' '{ print NF }')
 		# Test all subvalue of "modengines" using the ";" separator.
 		for ((gamevarindex=1; gamevarindex < ${enginesamount}; gamevarindex++)); do
 			# Put current engine name into modtest variable.
-			enginemodtest="$( echo -e "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
+			enginemodtest=$( echo -e "${modengines}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )
 			# If engine name matches.
 			if [ "${enginemodtest}" == "${engine}" ]; then
 				# Mod is compatible.
@@ -348,11 +348,11 @@ fn_not_compatible_mod_games(){
 	# If value is set to NOTGAMES (ignore).
 	if [ "${modexcludegames}" != "NOTGAMES" ]; then
 		# How many engines we need to test.
-		excludegamesamount="$(echo -e "${modexcludegames}" | awk -F ';' '{ print NF }')"
+		excludegamesamount=$(echo -e "${modexcludegames}" | awk -F ';' '{ print NF }')
 		# Test all subvalue of "modexcludegames" using the ";" separator.
 		for ((gamevarindex=1; gamevarindex < excludegamesamount; gamevarindex++)); do
 			# Put current engine name into modtest variable.
-			excludegamemodtest="$( echo -e "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )"
+			excludegamemodtest=$( echo -e "${modexcludegames}" | awk -F ';' -v x=${gamevarindex} '{ print $x }' )
 			# If engine name matches.
 			if [ "${excludegamemodtest}" == "${gamename}" ]; then
 				# Mod is compatible.
@@ -461,7 +461,7 @@ fn_mods_clear_tmp_dir(){
 # Counts how many mods were installed.
 fn_mods_count_installed(){
 	if [ -f "${modsinstalledlistfullpath}" ]; then
-		installedmodscount="$(wc -l < "${modsinstalledlistfullpath}")"
+		installedmodscount=$(wc -l < "${modsinstalledlistfullpath}")
 	else
 		installedmodscount=0
 	fi
@@ -486,7 +486,7 @@ fn_check_mod_files_list(){
 	# File list must exist and be valid before any operation on it.
 	if [ -f "${modsdir}/${modcommand}-files.txt" ]; then
 	# How many lines is the file list.
-		modsfilelistsize="$(wc -l < "${modsdir}/${modcommand}-files.txt")"
+		modsfilelistsize=$(wc -l < "${modsdir}/${modcommand}-files.txt")
 		# If file list is empty.
 		if [ "${modsfilelistsize}" -eq 0 ]; then
 			fn_print_failure "${modcommand}-files.txt is empty"

+ 8 - 8
lgsm/functions/mods_list.sh

@@ -10,36 +10,36 @@
 
 local commandname="MODS"
 local commandaction="List Mods"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 # Get a proper URL for mods that don't provide a good one (optional)
 fn_script_log_info "Retrieving latest mods URLs"
 # Metamod
 metamodmversion="1.10"
 metamodscrapeurl="https://mms.alliedmods.net/mmsdrop/${metamodmversion}/mmsource-latest-linux"
-metamodlatestfile="$(wget "${metamodscrapeurl}" -q -O -)"
+metamodlatestfile=$(wget "${metamodscrapeurl}" -q -O -)
 metamoddownloadurl="https://www.metamodsource.net/latest.php?os=linux&version=${metamodmversion}"
 metamodurl="${metamoddownloadurl}"
 # Sourcemod
 sourcemodmversion="1.10"
 sourcemodscrapeurl="https://sm.alliedmods.net/smdrop/${sourcemodmversion}/sourcemod-latest-linux"
-sourcemodlatestfile="$(wget "${sourcemodscrapeurl}" -q -O -)"
+sourcemodlatestfile=$(wget "${sourcemodscrapeurl}" -q -O -)
 sourcemoddownloadurl="https://www.sourcemod.net/latest.php?os=linux&version=${sourcemodmversion}"
 sourcemodurl="${sourcemoddownloadurl}"
 # Steamworks
 steamworksscrapeurl="https://users.alliedmods.net/~kyles/builds/SteamWorks"
-steamworkslatestfile="$(curl -sL ${steamworksscrapeurl} | grep -m 1 linux | cut -d '"' -f 4)"
+steamworkslatestfile=$(curl -sL ${steamworksscrapeurl} | grep -m 1 linux | cut -d '"' -f 4)
 steamworksdownloadurl="${steamworksscrapeurl}/${steamworkslatestfile}"
 steamworksurl="${steamworksdownloadurl}"
 # CS:GO Mods
-get5scrapepath="$(curl -sL https://ci.splewis.net/job/get5/lastSuccessfulBuild/api/xml | grep -oP "<relativePath>\K(.+)(?=</relativePath>)")"
-get5latestfile="$(echo -e "${get5scrapepath}" | xargs -n 1 -I @ sh -c "echo -e "basename "@""")"
+get5scrapepath=$(curl -sL https://ci.splewis.net/job/get5/lastSuccessfulBuild/api/xml | grep -oP "<relativePath>\K(.+)(?=</relativePath>)")
+get5latestfile=$(echo -e "${get5scrapepath}" | xargs -n 1 -I @ sh -c "echo -e "basename "@""")
 get5downloadurl="https://ci.splewis.net/job/get5/lastSuccessfulBuild/artifact/${get5scrapepath}"
 get5url="${get5downloadurl}"
 # Oxide
 oxiderustlatestlink="https://umod.org/games/rust/download/develop" # fix for linux build 06.09.2019
-oxidehurtworldlatestlink="$(curl -sL https://api.github.com/repos/OxideMod/Oxide.Hurtworld/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep "Oxide.Hurtworld.zip")"
-oxidesdtdlatestlink="$(curl -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | grep browser_download_url | cut -d '"' -f 4)"
+oxidehurtworldlatestlink=$(curl -sL https://api.github.com/repos/OxideMod/Oxide.Hurtworld/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep "Oxide.Hurtworld.zip")
+oxidesdtdlatestlink=$(curl -sL https://api.github.com/repos/OxideMod/Oxide.SevenDaysToDie/releases/latest | grep browser_download_url | cut -d '"' -f 4)
 
 # Define mods information (required)
 

+ 1 - 1
lgsm/functions/query_gamedig.sh

@@ -6,7 +6,7 @@
 # https://github.com/sonicsnes/node-gamedig
 
 # Check if gamedig and jq are installed.
-if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then
+if [ -n "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then
 
 	# will bypass query if server offline.
 	check_status.sh

+ 2 - 2
lgsm/functions/update_factorio.sh

@@ -6,7 +6,7 @@
 
 local commandname="UPDATE"
 local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_update_factorio_dl(){
 	fn_fetch_file "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz"
@@ -43,7 +43,7 @@ fn_update_factorio_localbuild(){
 
 fn_update_factorio_remotebuild(){
 	# Gets remote build info.
-	remotebuild=$(${curlpath} -s "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1)
+	remotebuild=$(curl -s "https://factorio.com/get-download/${downloadbranch}/headless/${factorioarch}" | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1)
 	if [ "${installer}" != "1" ]; then
 		fn_print_dots "Checking for update: ${remotelocation}: checking remote build"
 		# Checks if remotebuild variable has been set.

+ 4 - 4
lgsm/functions/update_minecraft.sh

@@ -6,11 +6,11 @@
 
 local commandname="UPDATE"
 local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_update_minecraft_dl(){
-	latestmcreleaselink=$(${curlpath} -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.latest.release as $latest | .versions[] | select(.id == $latest) | .url')
-	latestmcbuildurl=$(${curlpath} -s "${latestmcreleaselink}" | jq -r '.downloads.server.url')
+	latestmcreleaselink=$(curl -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.latest.release as $latest | .versions[] | select(.id == $latest) | .url')
+	latestmcbuildurl=$(curl -s "${latestmcreleaselink}" | jq -r '.downloads.server.url')
 	fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "minecraft_server.${remotebuild}.jar"
 	echo -e "copying to ${serverfiles}...\c"
 	cp "${tmpdir}/minecraft_server.${remotebuild}.jar" "${serverfiles}/minecraft_server.jar"
@@ -98,7 +98,7 @@ fn_update_minecraft_localbuild(){
 
 fn_update_minecraft_remotebuild(){
 	# Gets remote build info.
-	remotebuild=$(${curlpath} -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r '.latest.release')
+	remotebuild=$(curl -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r '.latest.release')
 	if [ "${installer}" != "1" ]; then
 		fn_print_dots "Checking for update: ${remotelocation}: checking remote build"
 		# Checks if remotebuild variable has been set.

+ 4 - 4
lgsm/functions/update_mta.sh

@@ -6,7 +6,7 @@
 
 local commandname="UPDATE"
 local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_update_mta_dl(){
 	fn_fetch_file "http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz" "${tmpdir}" "multitheftauto_linux_x64.tar.gz"
@@ -99,9 +99,9 @@ fn_update_mta_localbuild(){
 
 fn_update_mta_remotebuild(){
 	# Gets remote build info.
-	majorversion="$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MAJOR" | awk '{ print $3 }' | sed 's/\r//g')"
-	minorversion="$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MINOR" | awk '{ print $3 }' | sed 's/\r//g')"
-	maintenanceversion="$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MAINTENANCE" | awk '{ print $3 }' | sed 's/\r//g')"
+	majorversion=$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MAJOR" | awk '{ print $3 }' | sed 's/\r//g')
+	minorversion=$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MINOR" | awk '{ print $3 }' | sed 's/\r//g')
+	maintenanceversion=$(curl -s https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h | grep "#define MTASA_VERSION_MAINTENANCE" | awk '{ print $3 }' | sed 's/\r//g')
 	remotebuild="${majorversion}.${minorversion}.${maintenanceversion}"
 	if [ "${installer}" != "1" ]; then
 		fn_print_dots "Checking for update: ${remotelocation}: checking remote build"

+ 2 - 2
lgsm/functions/update_mumble.sh

@@ -6,7 +6,7 @@
 
 local commandname="UPDATE"
 local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_update_mumble_dl(){
 	fn_fetch_file "https://github.com/mumble-voip/mumble/releases/download/${remotebuild}/murmur-static_${mumblearch}-${remotebuild}.tar.bz2" "${tmpdir}" "murmur-static_${mumblearch}-${remotebuild}.tar.bz2"
@@ -43,7 +43,7 @@ fn_update_mumble_localbuild(){
 
 fn_update_mumble_remotebuild(){
 	# Gets remote build info.
-	remotebuild=$(${curlpath} -s "https://api.github.com/repos/mumble-voip/mumble/releases/latest" | grep 'murmur-static_x86.*\.bz2"' | tail -1 | awk -F"/" '{ print $8 }')
+	remotebuild=$(curl -s "https://api.github.com/repos/mumble-voip/mumble/releases/latest" | grep 'murmur-static_x86.*\.bz2"' | tail -1 | awk -F"/" '{ print $8 }')
 	if [ "${installer}" != "1" ]; then
 		fn_print_dots "Checking for update: ${remotelocation}: checking remote build"
 		# Checks if remotebuild variable has been set.

+ 2 - 2
lgsm/functions/update_steamcmd.sh

@@ -6,14 +6,14 @@
 
 local commandname="UPDATE"
 local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_update_steamcmd_dl(){
 	info_config.sh
 
 	# Detects if unbuffer command is available for 32 bit distributions only.
 	info_distro.sh
-	if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
+	if [ -n "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then
 		unbuffer="stdbuf -i0 -o0 -e0"
 	fi
 

+ 7 - 7
lgsm/functions/update_ts3.sh

@@ -6,13 +6,13 @@
 
 local commandname="UPDATE"
 local commandaction="Update"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 
 fn_update_ts3_dl(){
 	if [ "${ts3arch}" == "amd64" ]; then
-		remotebuildurl=$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.mirrors."teamspeak.com"')
+		remotebuildurl=$(curl -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.mirrors."teamspeak.com"')
 	elif [ "${ts3arch}" == "x86" ]; then
-		remotebuildurl=$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86.mirrors."teamspeak.com"')
+		remotebuildurl=$(curl -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86.mirrors."teamspeak.com"')
 	fi
 	fn_fetch_file "${remotebuildurl}" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2"
 	fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${remotebuild}.tar.bz2" "${tmpdir}"
@@ -68,7 +68,7 @@ fn_update_ts3_localbuild(){
 	fi
 
 	if [ -z "${localbuild}" ]; then
-		localbuild=$(cat $(find ./* -name "ts3server*_0.log" 2> /dev/null | sort | tail -1) | grep -Eo "TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | grep -Eo "((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | tail -1)
+		localbuild=$(cat "$(find ./* -name "ts3server*_0.log" 2> /dev/null | sort | tail -1)" | grep -Eo "TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | grep -Eo "((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | tail -1)
 	fi
 
 	if [ -z "${localbuild}" ]; then
@@ -81,7 +81,7 @@ fn_update_ts3_localbuild(){
 				loopignore=1
 				fn_script_log_info "Waiting for local build to generate"
 			fi
-			localbuild=$(cat $(find ./* -name "ts3server*_0.log" 2> /dev/null | sort | tail -1) | grep -Eo "TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | grep -Eo "((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | tail -1)
+			localbuild=$(cat "$(find ./* -name "ts3server*_0.log" 2> /dev/null | sort | tail -1)" | grep -Eo "TeamSpeak 3 Server ((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | grep -Eo "((\.)?[0-9]{1,3}){1,3}\.[0-9]{1,3}" | tail -1)
 			if [ "${localbuild}" ]; then
 				break
 			fi
@@ -104,9 +104,9 @@ fn_update_ts3_localbuild(){
 fn_update_ts3_remotebuild(){
 	# Gets remote build info.
 	if [ "${arch}" == "x86_64" ]; then
-		remotebuild="$(${curlpath} -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86_64.version')"
+		remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86_64.version')
 	elif [ "${arch}" == "x86" ]; then
-		remotebuild="$(${curlpath} -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86.version')"
+		remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86.version')
 	fi
 	if [ "${installer}" != "1" ]; then
 		fn_print_dots "Checking for update: ${remotelocation}: checking remote build"

+ 8 - 11
linuxgsm.sh

@@ -23,8 +23,8 @@ fi
 version="v19.11.0"
 shortname="core"
 gameservername="core"
-rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
-selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
+selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 lockselfname=".${selfname}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -51,7 +51,7 @@ githubbranch="master"
 
 # Core function that is required first.
 core_functions.sh(){
-	functionfile="${FUNCNAME}"
+	functionfile="${FUNCNAME[0]}"
 	fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 }
 
@@ -70,14 +70,12 @@ fn_bootstrap_fetch_file(){
 		if [ ! -d "${local_filedir}" ]; then
 			mkdir -p "${local_filedir}"
 		fi
-		# Defines curl path.
-		curlpath=$(command -v curl 2>/dev/null)
 
 		# If curl exists download file.
-		if [ "$(basename "${curlpath}")" == "curl" ]; then
+		if [ -n "$(command -v curl 2>/dev/null)" ]; then
 			# Trap to remove part downloaded files.
 			echo -en "    fetching ${local_filename}...\c"
-			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+			curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
 				echo -e "FAIL"
@@ -127,14 +125,13 @@ fn_bootstrap_fetch_file_github(){
 # Installer menu.
 
 fn_print_center() {
-	columns="$(tput cols)"
+	columns=$(tput cols)
 	line="$*"
 	printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}"
 }
 
 fn_print_horizontal(){
-	char="${1:-=}"
-	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
+	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "="
 }
 
 # Bash menu.
@@ -237,7 +234,7 @@ fn_install_file(){
 	if [ -e "${local_filename}" ]; then
 		i=2
 	while [ -e "${local_filename}-${i}" ] ; do
-		let i++
+		(( i++ ))
 	done
 		local_filename="${local_filename}-${i}"
 	fi

+ 8 - 11
tests/tests_fctrserver.sh

@@ -23,8 +23,8 @@ fi
 version="v19.9.0"
 shortname="fctr"
 gameservername="fctrserver"
-rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
-selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
+selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 lockselfname=".${selfname}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -60,7 +60,7 @@ githubbranch="${TRAVIS_BRANCH}"
 
 # Core function that is required first.
 core_functions.sh(){
-	functionfile="${FUNCNAME}"
+	functionfile="${FUNCNAME[0]}"
 	fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 }
 
@@ -81,14 +81,12 @@ fn_bootstrap_fetch_file(){
 		if [ ! -d "${local_filedir}" ]; then
 			mkdir -p "${local_filedir}"
 		fi
-		# Defines curl path.
-		curlpath=$(command -v curl 2>/dev/null)
 
 		# If curl exists download file.
-		if [ "$(basename "${curlpath}")" == "curl" ]; then
+		if [ -n "$(command -v curl 2>/dev/null)" ]; then
 			# Trap to remove part downloaded files.
 			echo -en "    fetching ${local_filename}...\c"
-			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+			curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
 				echo -e "FAIL"
@@ -138,14 +136,13 @@ fn_bootstrap_fetch_file_github(){
 # Installer menu.
 
 fn_print_center() {
-	columns="$(tput cols)"
+	columns=$(tput cols)
 	line="$*"
 	printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}"
 }
 
 fn_print_horizontal(){
-	char="${1:-=}"
-	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
+	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "="
 }
 
 # Bash menu.
@@ -248,7 +245,7 @@ fn_install_file(){
 	if [ -e "${local_filename}" ]; then
 		i=2
 	while [ -e "${local_filename}-${i}" ] ; do
-		let i++
+		(( i++ ))
 	done
 		local_filename="${local_filename}-${i}"
 	fi

+ 8 - 10
tests/tests_jc2server.sh

@@ -23,8 +23,8 @@ fi
 version="v19.9.0"
 shortname="jc2"
 gameservername="jc2server"
-rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
-selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
+selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 lockselfname=".${selfname}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -60,7 +60,7 @@ githubbranch="${TRAVIS_BRANCH}"
 
 # Core function that is required first.
 core_functions.sh(){
-	functionfile="${FUNCNAME}"
+	functionfile="${FUNCNAME[0]}"
 	fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 }
 
@@ -79,14 +79,12 @@ fn_bootstrap_fetch_file(){
 		if [ ! -d "${local_filedir}" ]; then
 			mkdir -p "${local_filedir}"
 		fi
-		# Defines curl path.
-		curlpath=$(command -v curl 2>/dev/null)
 
 		# If curl exists download file.
-		if [ "$(basename "${curlpath}")" == "curl" ]; then
+		if [ "$(command -v curl 2>/dev/null)" ]; then
 			# Trap to remove part downloaded files.
 			echo -en "    fetching ${local_filename}...\c"
-			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+			curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
 				echo -e "FAIL"
@@ -111,6 +109,7 @@ fn_bootstrap_fetch_file(){
 	if [ -f "${local_filedir}/${local_filename}" ]; then
 		# Run file if run is set.
 		if [ "${run}" == "run" ]; then
+			# shellcheck source=/dev/null
 			source "${local_filedir}/${local_filename}"
 		fi
 	fi
@@ -135,14 +134,13 @@ fn_bootstrap_fetch_file_github(){
 # Installer menu.
 
 fn_print_center() {
-	columns="$(tput cols)"
+	columns=$(tput cols)
 	line="$*"
 	printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}"
 }
 
 fn_print_horizontal(){
-	char="${1:-=}"
-	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
+	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "="
 }
 
 # Bash menu.

+ 8 - 11
tests/tests_mcserver.sh

@@ -23,8 +23,8 @@ fi
 version="v19.9.0"
 shortname="mc"
 gameservername="mcserver"
-rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
-selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
+selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 lockselfname=".${selfname}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -60,7 +60,7 @@ githubbranch="${TRAVIS_BRANCH}"
 
 # Core function that is required first.
 core_functions.sh(){
-	functionfile="${FUNCNAME}"
+	functionfile="${FUNCNAME[0]}"
 	fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 }
 
@@ -79,14 +79,12 @@ fn_bootstrap_fetch_file(){
 		if [ ! -d "${local_filedir}" ]; then
 			mkdir -p "${local_filedir}"
 		fi
-		# Defines curl path.
-		curlpath=$(command -v curl 2>/dev/null)
 
 		# If curl exists download file.
-		if [ "$(basename "${curlpath}")" == "curl" ]; then
+		if [ -n "$(command -v curl 2>/dev/null)" ]; then
 			# Trap to remove part downloaded files.
 			echo -en "    fetching ${local_filename}...\c"
-			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+			curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
 				echo -e "FAIL"
@@ -111,7 +109,7 @@ fn_bootstrap_fetch_file(){
 	if [ -f "${local_filedir}/${local_filename}" ]; then
 		# Run file if run is set.
 		if [ "${run}" == "run" ]; then
-			# shellcheck source=/dev/null      
+			# shellcheck source=/dev/null
 			source "${local_filedir}/${local_filename}"
 		fi
 	fi
@@ -136,14 +134,13 @@ fn_bootstrap_fetch_file_github(){
 # Installer menu.
 
 fn_print_center() {
-	columns="$(tput cols)"
+	columns=$(tput cols)
 	line="$*"
 	printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}"
 }
 
 fn_print_horizontal(){
-	char="${1:-=}"
-	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
+	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "="
 }
 
 # Bash menu.

+ 9 - 12
tests/tests_ts3server.sh

@@ -23,8 +23,8 @@ fi
 version="v19.9.0"
 shortname="ts3"
 gameservername="ts3server"
-rootdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
-selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+rootdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
+selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
 lockselfname=".${selfname}.lock"
 lgsmdir="${rootdir}/lgsm"
 logdir="${rootdir}/log"
@@ -60,7 +60,7 @@ githubbranch="${TRAVIS_BRANCH}"
 
 # Core function that is required first.
 core_functions.sh(){
-	functionfile="${FUNCNAME}"
+	functionfile="${FUNCNAME[0]}"
 	fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5"
 }
 
@@ -79,14 +79,12 @@ fn_bootstrap_fetch_file(){
 		if [ ! -d "${local_filedir}" ]; then
 			mkdir -p "${local_filedir}"
 		fi
-		# Defines curl path.
-		curlpath=$(command -v curl 2>/dev/null)
 
 		# If curl exists download file.
-		if [ "$(basename "${curlpath}")" == "curl" ]; then
+		if [ -n "$(command -v curl 2>/dev/null)" ]; then
 			# Trap to remove part downloaded files.
 			echo -en "    fetching ${local_filename}...\c"
-			curlcmd=$(${curlpath} -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
+			curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1)
 			local exitcode=$?
 			if [ ${exitcode} -ne 0 ]; then
 				echo -e "FAIL"
@@ -111,7 +109,7 @@ fn_bootstrap_fetch_file(){
 	if [ -f "${local_filedir}/${local_filename}" ]; then
 		# Run file if run is set.
 		if [ "${run}" == "run" ]; then
-			# shellcheck source=/dev/null      
+			# shellcheck source=/dev/null
 			source "${local_filedir}/${local_filename}"
 		fi
 	fi
@@ -136,14 +134,13 @@ fn_bootstrap_fetch_file_github(){
 # Installer menu.
 
 fn_print_center() {
-	columns="$(tput cols)"
+	columns=$(tput cols)
 	line="$*"
 	printf "%*s\n" $(( (${#line} + columns) / 2)) "${line}"
 }
 
 fn_print_horizontal(){
-	char="${1:-=}"
-	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "${char}"
+	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' "="
 }
 
 # Bash menu.
@@ -246,7 +243,7 @@ fn_install_file(){
 	if [ -e "${local_filename}" ]; then
 		i=2
 	while [ -e "${local_filename}-${i}" ] ; do
-		let i++
+		(( i++ ))
 	done
 		local_filename="${local_filename}-${i}"
 	fi