gameservergame-servergame-servershacktoberfestdedicated-game-serversgamelinuxgsmserverbashgaminglinuxmultiplayer-game-servershell
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
3.6 KiB
84 lines
3.6 KiB
#!/bin/bash
|
|
# LGSM fn_install_ts3 function
|
|
# Author: Daniel Gibbs
|
|
# Website: http://gameservermanagers.com
|
|
# Version: 120515
|
|
|
|
fn_details_config
|
|
# Gets the teamspeak server architecture
|
|
ts3arch=${arch}
|
|
|
|
# Grabs all version numbers 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
|
|
|
|
# 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"
|
|
if [[ $? == 0 ]]; then
|
|
availablebuild="${ts3_version_number}"
|
|
# 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
|
|
|
|
# Checks availablebuild info is available
|
|
if [ -z "${availablebuild}" ]; then
|
|
fn_printfail "Checking for update: teamspeak.com"
|
|
fn_scriptlog "Checking for update: teamspeak.com"
|
|
sleep 1
|
|
fn_printfail "Checking for update: teamspeak.com: Not returning version info"
|
|
fn_scriptlog "Failure! Checking for update: teamspeak.com: Not returning version info"
|
|
sleep 2
|
|
exit
|
|
fi
|
|
|
|
cd "${rootdir}"
|
|
echo -e "downloading teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz...\c"
|
|
fn_scriptlog "Downloading teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz"
|
|
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
|
|
sleep 1
|
|
echo -e "extracting teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz...\c"
|
|
fn_scriptlog "Extracting teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz"
|
|
tar -xf "teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz" 2> "${scriptlogdir}/.${servicename}-tar-error.tmp"
|
|
local status=$?
|
|
if [ ${status} -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL - Exit status ${status}"
|
|
fn_scriptlog "Failed to extract - Exit status ${status}"
|
|
sleep 1
|
|
cat "${scriptlogdir}/.${servicename}-tar-error.tmp"
|
|
cat "${scriptlogdir}/.${servicename}-tar-error.tmp" >> "${scriptlog}"
|
|
rm "${scriptlogdir}/.${servicename}-tar-error.tmp"
|
|
fn_scriptlog "Failure! Unable to update"
|
|
exit
|
|
fi
|
|
echo -e "copying to ${filesdir}...\c"
|
|
fn_scriptlog "Copying to ${filesdir}"
|
|
cp -R "${rootdir}/teamspeak3-server_linux-${ts3arch}/*" "${filesdir}" 2> "${scriptlogdir}/.${servicename}-cp-error.tmp"
|
|
local status=$?
|
|
if [ ${status} -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL - Exit status ${status}"
|
|
fn_scriptlog "Failed to copy - Exit status ${status}"
|
|
sleep 1
|
|
cat "${scriptlogdir}/.${servicename}-cp-error.tmp"
|
|
cat "${scriptlogdir}/.${servicename}-cp-error.tmp" >> "${scriptlog}"
|
|
rm "${scriptlogdir}/.${servicename}-cp-error.tmp"
|
|
fn_scriptlog "Failure! Unable to update"
|
|
exit
|
|
fi
|
|
rm -f teamspeak3-server_linux-${ts3arch}-${availablebuild}.tar.gz
|
|
rm -rf "${rootdir}/teamspeak3-server_linux-${ts3arch}"
|
|
|
|
|