Skip to content

Commit

Permalink
fix(update-lgsm): versions before v20.3.0 will not use version tags (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgibbs64 committed May 21, 2020
1 parent 04bb848 commit eb38074
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 52 deletions.
6 changes: 1 addition & 5 deletions lgsm/functions/check_ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 2 additions & 10 deletions lgsm/functions/check_steamcmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions lgsm/functions/command_monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
66 changes: 33 additions & 33 deletions lgsm/functions/command_update_linuxgsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lgsm/functions/core_dl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion lgsm/functions/core_legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit eb38074

Please sign in to comment.