Browse Source

made corrections to ts3 server installer

pull/673/head
Daniel Gibbs 9 years ago
parent
commit
d7ff36d12d
  1. 34
      functions/install_ts3.sh
  2. 16
      functions/update_check.sh

34
functions/install_ts3.sh

@ -15,29 +15,29 @@ else
exit 1
fi
# Grabs all version numbers not in correct order
# 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 > .ts3_version_numbers_unsorted.tmp
# removes digits to allow sorting of numbers
cat .ts3_version_numbers_unsorted.tmp |tr -cd '[:digit:][*\n]' > .ts3_version_numbers_digit.tmp
# Sorts numbers in to correct order
# merges two files in to one with two columns sorts the numbers in to order then only outputs the second to the ts3_version_numbers.tmp
paste .ts3_version_numbers_digit.tmp .ts3_version_numbers_unsorted.tmp |sort -rn|awk '{ print $2 }' > .ts3_version_numbers.tmp
# Replaces dots with spaces to split up the number. e.g 3 0 12 1 is 3.0.12.1 this allows correct sorting
cat .ts3_version_numbers_unsorted.tmp | tr "." " " > .ts3_version_numbers_digit.tmp
# Sorts versions in to correct order
# merges 2 files and orders by each column in order allowing these version numbers to be sorted in order
paste .ts3_version_numbers_digit.tmp .ts3_version_numbers_unsorted.tmp | awk '{print $1,$2,$3,$4 " " $0;}'| sort -k1rn -k2rn -k3rn -k4rn | awk '{print $NF}' > .ts3_version_numbers.tmp
# Finds directory with most recent server version.
while read ts3_version_number; do
wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux-${ts3arch}-${ts3_version_number}.tar.gz"
wget --spider -q "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
if [ $? -eq 0 ]; then
availablebuild="${ts3_version_number}"
echo "Latest Build: ${availablebuild}"
# Break while-loop, if the latest release could be found
echo "http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-66server_linux-${ts3arch}-${ts3_version_number}.tar.g"
break
fi
done < .ts3_version_numbers.tmp
rm -f .ts3_version_numbers_digit.tmp
rm -f .ts3_version_numbers_unsorted.tmp
rm -f .ts3_version_numbers.tmp
# tidy up
rm -f ".ts3_version_numbers_digit.tmp"
rm -f ".ts3_version_numbers_unsorted.tmp"
rm -f ".ts3_version_numbers.tmp"
# Checks availablebuild info is available
if [ -z "${availablebuild}" ]; then
@ -49,11 +49,11 @@ if [ -z "${availablebuild}" ]; then
fi
cd "${rootdir}"
echo -e "downloading teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz...\c"
wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux-${ts3arch}-${ts3_version_number}.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq
echo -e "downloading teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c"
wget -N /dev/null http://dl.4players.de/ts/releases/${ts3_version_number}/teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2 2>&1 | grep -F HTTP | cut -c45-| uniq
sleep 1
echo -e "extracting teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz...\c"
tar -xf "teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz" 2> ".${servicename}-tar-error.tmp"
echo -e "extracting teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2...\c"
tar -xf "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2" 2> ".${servicename}-tar-error.tmp"
local status=$?
if [ ${status} -eq 0 ]; then
echo "OK"
@ -76,5 +76,5 @@ else
rm ".${servicename}-cp-error.tmp"
exit $?
fi
rm -f teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz
rm -f "teamspeak3-server_linux_${ts3arch}-${ts3_version_number}.tar.bz2"
rm -rf "${rootdir}/teamspeak3-server_linux-${ts3arch}"

16
functions/update_check.sh

@ -212,13 +212,13 @@ ts3arch=$(ls $(find ${filesdir}/ -name 'ts3server_*_*' 2> /dev/null | grep -v 't
# Gets availablebuild info
# Grabs all version numbers not in correct order
# 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 > .ts3_version_numbers_unsorted.tmp
# removes digits to allow sorting of numbers
# Replaces dots with spaces to split up the number. e.g 3 0 12 1 is 3.0.12.1 this allows correct sorting
cat .ts3_version_numbers_unsorted.tmp | tr "." " " > .ts3_version_numbers_digit.tmp
# Sorts numbers in to correct order
# merges two files in to one with two columns sorts the numbers in to order then only outputs the second to the ts3_version_numbers.tmp
# Sorts versions in to correct order
# merges 2 files and orders by each column in order allowing these version numbers to be sorted in order
paste .ts3_version_numbers_digit.tmp .ts3_version_numbers_unsorted.tmp | awk '{print $1,$2,$3,$4 " " $0;}'| sort -k1rn -k2rn -k3rn -k4rn | awk '{print $NF}' > .ts3_version_numbers.tmp
# Finds directory with most recent server version.
@ -230,9 +230,11 @@ while read ts3_version_number; do
break
fi
done < .ts3_version_numbers.tmp
rm -f .ts3_version_numbers_digit.tmp
rm -f .ts3_version_numbers_unsorted.tmp
rm -f .ts3_version_numbers.tmp
# tidy up
rm -f ".ts3_version_numbers_digit.tmp"
rm -f ".ts3_version_numbers_unsorted.tmp"
rm -f ".ts3_version_numbers.tmp"
# Checks availablebuild info is available
if [ -z "${availablebuild}" ]; then

Loading…
Cancel
Save