From bbaf203634cb4e7da9381462a02ca582adbbf714 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 27 Oct 2018 13:38:48 +0100 Subject: [PATCH] Teamspeak updater will only update if cur version is less than avail --- lgsm/functions/update_ts3.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index ce41eef25..8471e9952 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -8,7 +8,7 @@ local commandname="UPDATE" local commandaction="Update" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_ts3_dl(){ +fn_update_ts3_dl_legacy(){ fn_fetch_file "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" @@ -22,6 +22,21 @@ fn_update_ts3_dl(){ fi } +fn_update_ts3_dl(){ + latestmcreleaselink=$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.mirrors."4Netplayers.de"') + fn_fetch_file "${latestmcbuildurl}" "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" + fn_dl_extract "${tmpdir}" "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" "${tmpdir}" + echo -e "copying to ${serverfiles}...\c" + fn_script_log "Copying to ${serverfiles}" + cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}" + local exitcode=$? + if [ "${exitcode}" == "0" ]; then + fn_print_ok_eol_nl + else + fn_print_fail_eol_nl + fi +} + fn_update_ts3_currentbuild(){ # Gets current build info # Checks if current build info is available. If it fails, then a server restart will be forced to generate logs. @@ -152,7 +167,7 @@ fn_update_ts3_compare(){ currentbuilddigit=$(echo "${currentbuild}" | tr -cd '[:digit:]') availablebuilddigit=$(echo "${availablebuild}" | tr -cd '[:digit:]') - if [ "${currentbuilddigit}" -ne "${availablebuilddigit}" ]; then + if [ "${currentbuilddigit}" -lt "${availablebuilddigit}" ]; then echo -e "\n" echo -e "Update available:" sleep 0.5 @@ -207,10 +222,11 @@ if [ "${installer}" == "1" ]; then # if jq available uses json update checker if [ "$(command -v jq >/dev/null 2>&1)" ]; then fn_update_ts3_availablebuild + fn_update_ts3_dl else fn_update_ts3_availablebuild_legacy + fn_update_ts3_dl_legacy fi - fn_update_ts3_dl else # Checks for server update from teamspeak.com using a mirror dl.4players.de. fn_print_dots "Checking for update: teamspeak.com"