Browse Source

Merge branch 'ts3server-installer'

Conflicts:
	functions/fn_getopt
pull/393/head
Daniel Gibbs 10 years ago
parent
commit
9aae0b3d8d
  1. 6
      functions/fn_getopt
  2. 10
      functions/fn_install
  3. 84
      functions/fn_install_ts3

6
functions/fn_getopt

@ -69,8 +69,12 @@ case "$getopt" in
fn_details;; fn_details;;
backup) backup)
fn_backup;; fn_backup;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*) *)
echo "Usage: $0 {start|stop|restart|update|update-funtions|monitor|email-test|details|backup}" echo "Usage: $0 {start|stop|restart|update|update-funtions|monitor|email-test|details|backup|install|auto-install}"
exit 1;; exit 1;;
esac esac
exit exit

10
functions/fn_install

@ -2,7 +2,7 @@
# LGSM fn_install function # LGSM fn_install function
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Website: http://gameservermanagers.com # Website: http://gameservermanagers.com
# Version: 060315 # Version: 190515
fn_check_root fn_check_root
fn_install_header fn_install_header
@ -15,12 +15,12 @@ if [ "${gamename}" == "Unreal Tournament 2004" ]; then
fn_install_ut2k4filesdl fn_install_ut2k4filesdl
fn_install_ut2k4 fn_install_ut2k4
fn_install_ut2k4key fn_install_ut2k4key
fi elif [ "${gamename}" == "Unreal Tournament 99" ]; then
if [ "${gamename}" == "Unreal Tournament 99" ]; then
fn_install_ut99filesdl fn_install_ut99filesdl
fn_install_ut99 fn_install_ut99
fi elif [ "${gamename}" == "Teamspeak 3" ]; then
if [ ! -z "${appid}" ]; then fn_install_ts3
elif [ ! -z "${appid}" ]; then
fn_install_steamcmd fn_install_steamcmd
fn_install_serverfiles fn_install_serverfiles
fn_install_steamfix fn_install_steamfix

84
functions/fn_install_ts3

@ -0,0 +1,84 @@
#!/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}"
Loading…
Cancel
Save