From 81e23c729e1f0667eaeb689406085b49580d5ef4 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 21 May 2020 17:21:37 +0100 Subject: [PATCH 1/4] fix(mods): resolve broken downloader for mods (#2899) --- lgsm/functions/mods_core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/mods_core.sh b/lgsm/functions/mods_core.sh index 8108e0d0ec..da2576207e 100644 --- a/lgsm/functions/mods_core.sh +++ b/lgsm/functions/mods_core.sh @@ -18,7 +18,7 @@ modsinstalledlistfullpath="${modsdir}/${modsinstalledlist}" # Download management. fn_mod_install_files(){ - fn_fetch_file "${modurl}" "${modstmpdir}" "${modfilename}" + fn_fetch_file "${modurl}" "" "" "" "${modstmpdir}" "${modfilename}" # Check if variable is valid checking if file has been downloaded and exists. if [ ! -f "${modstmpdir}/${modfilename}" ]; then fn_print_failure "An issue occurred downloading ${modprettyname}" From 04bb8485b805fad4c87dd2e33b21dfee7a38b8d3 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 21 May 2020 17:22:04 +0100 Subject: [PATCH 2/4] fix(update): fix update on start not working (#2901) * add space to grep to get accurate session name * move messages to get proper output --- lgsm/functions/command_start.sh | 7 +++++-- lgsm/functions/info_distro.sh | 2 +- lgsm/functions/update_factorio.sh | 4 ---- lgsm/functions/update_minecraft.sh | 4 ---- lgsm/functions/update_minecraft_bedrock.sh | 4 ---- lgsm/functions/update_mta.sh | 4 ---- lgsm/functions/update_mumble.sh | 4 ---- lgsm/functions/update_steamcmd.sh | 4 ---- lgsm/functions/update_ts3.sh | 4 ---- 9 files changed, 6 insertions(+), 31 deletions(-) diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh index 7ba90159d7..d0487e5d44 100644 --- a/lgsm/functions/command_start.sh +++ b/lgsm/functions/command_start.sh @@ -165,13 +165,12 @@ fn_start_tmux(){ echo -en "\n" } - check.sh -fn_print_dots "${servername}" # Is the server already started. # $status comes from check_status.sh, which is run by check.sh for this command if [ "${status}" != "0" ]; then + fn_print_dots "${servername}" fn_print_info_nl "${servername} is already running" fn_script_log_error "${servername} is already running" if [ -z "${exitbypass}" ]; then @@ -189,8 +188,12 @@ if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateon exitbypass=1 unset updateonstart command_update.sh + commandname="START" + commandaction="Starting" fi +fn_print_dots "${servername}" + if [ "${shortname}" == "ts3" ]; then fn_start_teamspeak3 else diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index 7f1ea12c14..1e2a519f4b 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" ### Game Server pid if [ "${status}" == "1" ]; then - gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}"| grep "^${sessionname}"|awk '{print $2}') + gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $2}') fi ### Distro information diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index 7d12c0f582..5ff67c4486 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -170,7 +170,3 @@ else fn_update_factorio_remotebuild fn_update_factorio_compare fi - -if [ "${commandname}" != "INSTALL" ]; then - core_exit.sh -fi diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index 8741db01d6..556097bd62 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -218,7 +218,3 @@ else fn_update_minecraft_remotebuild fn_update_minecraft_compare fi - -if [ "${commandname}" != "INSTALL" ]; then - core_exit.sh -fi diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh index b560f3672b..8f408bf299 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/functions/update_minecraft_bedrock.sh @@ -178,7 +178,3 @@ else fn_update_minecraft_remotebuild fn_update_minecraft_compare fi - -if [ "${commandname}" != "INSTALL" ]; then - core_exit.sh -fi diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index c37c5ba817..5aaecc122c 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -209,7 +209,3 @@ else fn_update_mta_remotebuild fn_update_mta_compare fi - -if [ "${commandname}" != "INSTALL" ]; then - core_exit.sh -fi diff --git a/lgsm/functions/update_mumble.sh b/lgsm/functions/update_mumble.sh index 00fbade5ec..ee6a2b0ad3 100644 --- a/lgsm/functions/update_mumble.sh +++ b/lgsm/functions/update_mumble.sh @@ -148,7 +148,3 @@ else fn_update_mumble_remotebuild fn_update_mumble_compare fi - -if [ "${commandname}" != "INSTALL" ]; then - core_exit.sh -fi diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index e7d018d19a..8a089c7f74 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -246,7 +246,3 @@ else fn_update_steamcmd_remotebuild fn_update_steamcmd_compare fi - -if [ "${commandname}" != "INSTALL" ]; then - core_exit.sh -fi diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index ec921b3f03..a5cc0dd608 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -219,7 +219,3 @@ else fn_update_ts3_remotebuild fn_update_ts3_compare fi - -if [ "${commandname}" != "INSTALL" ]; then - core_exit.sh -fi From eb3807464099752cca05ed43d91470dd192a9e14 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 21 May 2020 17:22:23 +0100 Subject: [PATCH 3/4] fix(update-lgsm): versions before v20.3.0 will not use version tags (#2900) --- lgsm/functions/check_ip.sh | 6 +-- lgsm/functions/check_steamcmd.sh | 12 +---- lgsm/functions/command_monitor.sh | 2 - lgsm/functions/command_update_linuxgsm.sh | 66 +++++++++++------------ lgsm/functions/core_dl.sh | 6 ++- lgsm/functions/core_legacy.sh | 10 +++- 6 files changed, 50 insertions(+), 52 deletions(-) diff --git a/lgsm/functions/check_ip.sh b/lgsm/functions/check_ip.sh index 0e027953cb..d8c4f3ed56 100644 --- a/lgsm/functions/check_ip.sh +++ b/lgsm/functions/check_ip.sh @@ -44,11 +44,7 @@ if [ "${travistest}" != "1" ]; then echo -en "\n" echo -en "Set ip=\"0.0.0.0\" to one of the following:\n" fn_script_log_fatal "Multiple IP addresses found." - if [ "${legacymode}" == "1" ]; then - fn_script_log_fatal "Specify the IP you want to bind within the ${selfname} script." - else - fn_script_log_fatal "Specify the IP you want to bind within: ${configdirserver}." - fi + fn_script_log_fatal "Specify the IP you want to bind within: ${configdirserver}." fi echo -en "${getip}\n" echo -en "\n" diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index b42d581dfa..aa4140bbea 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -31,18 +31,10 @@ fn_install_steamcmd(){ fn_check_steamcmd_user(){ # Checks if steamuser is setup. if [ "${steamuser}" == "username" ]; then - if [ "${legacymode}" == "1" ]; then - fn_print_fail_nl "Steam login not set. Update steamuser in ${selfname}" - else - fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" - fi + fn_print_fail_nl "Steam login not set. Update steamuser in ${configdirserver}" echo -e " * Change steamuser=\"username\" to a valid steam login." if [ -d "${lgsmlogdir}" ]; then - if [ "${legacymode}" == "1" ]; then - fn_script_log_fatal "Steam login not set. Update steamuser in ${selfname}" - else - fn_script_log_fatal "Steam login not set. Update steamuser in ${configdirserver}" - fi + fn_script_log_fatal "Steam login not set. Update steamuser in ${configdirserver}" fi core_exit.sh fi diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index 4b621c0d5f..3a333a578e 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -71,11 +71,9 @@ fn_monitor_check_queryport(){ fn_script_log_info "Checking port: CHECKING" if [ -n "${rconenabled}" ]&&[ "${rconenabled}" != "true" ]&&[ ${shortname} == "av" ]; then fn_print_warn "Checking port: Unable to query as rconport, rcon not enabled: " - fn_print_warn_eol_nl fn_script_log_warn "Checking port: Unable to query rconport, rcon not enabled: WARN" else fn_print_error "Checking port: Unable to query queryport is not set: " - fn_print_error_eol_nl fn_script_log_error "Checking port: Unable to query as queryport is not set: ERROR" fi core_exit.sh diff --git a/lgsm/functions/command_update_linuxgsm.sh b/lgsm/functions/command_update_linuxgsm.sh index 9e778c9ee3..c32bf321f9 100644 --- a/lgsm/functions/command_update_linuxgsm.sh +++ b/lgsm/functions/command_update_linuxgsm.sh @@ -32,39 +32,6 @@ else fn_print_ok_nl "Selecting repo: ${remotereponame}" fi -# Check _default.cfg. -echo -en "checking ${remotereponame} config _default.cfg...\c" -fn_script_log_info "Checking ${remotereponame} config _default.cfg" -if [ "${remotereponame}" == "GitHub" ]; then - curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null -else - curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null -fi -if [ $? != "0" ]; then - fn_print_fail_eol_nl - fn_script_log_fatal "Checking ${remotereponame} config _default.cfg" - fn_script_log_fatal "Curl returned error: $?" - core_exit.sh -fi - -if [ "${remotereponame}" == "GitHub" ]; then - 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")) -else - config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) -fi - -if [ "${config_file_diff}" != "" ]; then - fn_print_update_eol_nl - fn_script_log_update "Checking ${remotereponame} config _default.cfg" - rm -f "${configdirdefault:?}/config-lgsm/${gameservername:?}/_default.cfg" - fn_fetch_file_github "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "nochmodx" "norun" "noforce" "nomd5" - alert="config" - alert.sh -else - fn_print_ok_eol_nl - fn_script_log_pass "Checking ${remotereponame} config _default.cfg" -fi - # Check linuxsm.sh echo -en "checking ${remotereponame} linuxgsm.sh...\c" if [ "${remotereponame}" == "GitHub" ]; then @@ -144,6 +111,39 @@ else fn_script_log_info "Checking ${selfname}" fi +# Check _default.cfg. +echo -en "checking ${remotereponame} config _default.cfg...\c" +fn_script_log_info "Checking ${remotereponame} config _default.cfg" +if [ "${remotereponame}" == "GitHub" ]; then + curl -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null +else + curl -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1>/dev/null +fi +if [ $? != "0" ]; then + fn_print_fail_eol_nl + fn_script_log_fatal "Checking ${remotereponame} config _default.cfg" + fn_script_log_fatal "Curl returned error: $?" + core_exit.sh +fi + +if [ "${remotereponame}" == "GitHub" ]; then + 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")) +else + config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) +fi + +if [ "${config_file_diff}" != "" ]; then + fn_print_update_eol_nl + fn_script_log_update "Checking ${remotereponame} config _default.cfg" + rm -f "${configdirdefault:?}/config-lgsm/${gameservername:?}/_default.cfg" + fn_fetch_file_github "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "nochmodx" "norun" "noforce" "nomd5" + alert="config" + alert.sh +else + fn_print_ok_eol_nl + fn_script_log_pass "Checking ${remotereponame} config _default.cfg" +fi + # Check and update modules. if [ -n "${functionsdir}" ]; then if [ -d "${functionsdir}" ]; then diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index 8e2888add9..89ee784dbe 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -236,7 +236,11 @@ fn_fetch_file(){ fn_fetch_file_github(){ github_file_url_dir="${1}" github_file_url_name="${2}" - if [ "${githubbranch}" == "master" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then + if [ "${legacymode}" == "1" ]; then + # For legacy versions - code can be removed at a future date + remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${github_file_url_name}" + elif [ "${githubbranch}" == "master" ]&&[ "${commandname}" != "UPDATE-LGSM" ]; then remote_fileurl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${version}/${github_file_url_dir}/${github_file_url_name}" remote_fileurl_backup="https://bitbucket.org/${githubuser}/${githubrepo}/raw/${version}/${github_file_url_dir}/${github_file_url_name}" else diff --git a/lgsm/functions/core_legacy.sh b/lgsm/functions/core_legacy.sh index 520287ec88..3450d58428 100644 --- a/lgsm/functions/core_legacy.sh +++ b/lgsm/functions/core_legacy.sh @@ -6,8 +6,16 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +# This is to help the transition to v20.3.0 and above +legacy_versions_array=( v20.2.1 v20.2.0 v20.1.5 v20.1.4 v20.1.3 v20.1.2 v20.1.1 v20.1.0 v19.12.5 v19.12.4 v19.12.3 v19.12.2 v19.12.1 v19.12.0 ) +for legacy_version in "${legacy_versions_array[@]}" +do + if [ "${version}" == "${legacy_version}" ]; then + legacymode=1 + fi +done + if [ -z "${serverfiles}" ]; then - legacymode=1 serverfiles="${filesdir}" fi From 498cb6714603fc5c1efd5d729fefd4ef46cdc0ea Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 21 May 2020 17:42:23 +0100 Subject: [PATCH 4/4] release v20.3.1 --- lgsm/functions/core_functions.sh | 2 +- linuxgsm.sh | 2 +- tests/tests_fctrserver.sh | 2 +- tests/tests_jc2server.sh | 2 +- tests/tests_mcserver.sh | 2 +- tests/tests_ts3server.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index ae1b860a7f..8eb2483888 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v20.3.0" +modulesversion="v20.3.1" # Core diff --git a/linuxgsm.sh b/linuxgsm.sh index eaa2b31b76..3edbb09485 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.3.0" +version="v20.3.1" shortname="core" gameservername="core" commandname="CORE" diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 50f2a1b152..9d56e36efa 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.3.0" +version="v20.3.1" shortname="fctr" gameservername="fctrserver" commandname="CORE" diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index 61793bca0c..9ab94578ba 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.3.0" +version="v20.3.1" shortname="jc2" gameservername="jc2server" commandname="CORE" diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 8c3c6c2672..6e651b2ac8 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.3.0" +version="v20.3.1" shortname="mc" gameservername="mcserver" commandname="CORE" diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index 6b398364b1..0038138351 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.3.0" +version="v20.3.1" shortname="ts3" gameservername="ts3server" commandname="CORE"