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