Permalink
Browse files

update_ts3.sh can now use ts3 version json file is jq is installed

  • Loading branch information...
dgibbs64 committed Mar 12, 2018
1 parent 17bcde7 commit ada3909e6c7835dc7ebb32d2debc0f9624402bd7
Showing with 32 additions and 3 deletions.
  1. +32 −3 lgsm/functions/update_ts3.sh
@@ -83,8 +83,32 @@ else
fi
}
fn_update_ts3_availablebuild(){
# Gets latest build info.
if [ "${arch}" == "x86_64" ]; then
availablebuild=$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86_64.version')
elif [ "${arch}" == "x86" ]; then
availablebuild=$(${curlpath} -s 'https://www.teamspeak.com/versions/server.json' | jq -r '.linux.x86.version')
fi
# Checks if availablebuild variable has been set
if [ -z "${availablebuild}" ]; then
fn_print_fail "Checking for update: teamspeak.com"
sleep 0.5
fn_print_fail "Checking for update: teamspeak.com: Not returning version info"
fn_script_log_fatal "Failure! Checking for update: teamspeak.com: Not returning version info"
core_exit.sh
elif [ "${installer}" == "1" ]; then
:
else
fn_print_ok_nl "Checking for update: teamspeak.com"
fn_script_log_pass "Checking for update: teamspeak.com"
sleep 0.5
fi
}
fn_update_ts3_availablebuild_legacy(){
# Gets latest build info.
# Grabs all version numbers but not in correct order.
wget "http://dl.4players.de/ts/releases/?C=M;O=D" -q -O -| grep -i dir | egrep -o '<a href=\".*\/\">.*\/<\/a>' | egrep -o '[0-9\.?]+'|uniq > "${tmpdir}/.ts3_version_numbers_unsorted.tmp"
@@ -180,9 +204,14 @@ fn_update_ts3_compare(){
fn_update_ts3_arch
if [ "${installer}" == "1" ]; then
fn_update_ts3_availablebuild
fn_update_ts3_dl
else
# if jq available uses json update checker
if [ "$(command -v jq)" ]||[ "$(which jq >/dev/null 2>&1)" ]; then
fn_update_ts3_availablebuild
else
fn_update_ts3_availablebuild_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"
fn_script_log_info "Checking for update: teamspeak.com"

0 comments on commit ada3909

Please sign in to comment.