#!/bin/ash
# TS3 Installation Script
#
# Server Files: /mnt/server

if [ -z ${TS_VERSION} ] || [ ${TS_VERSION} == latest ]; then
    TS_VERSION=$(curl -sSL https://teamspeak.com/versions/server.json | jq -r '.linux.x86_64.version')
fi

cd /mnt/server

echo -e "getting files from http://files.teamspeak-services.com/releases/server/${TS_VERSION}/teamspeak3-server_linux_amd64-${TS_VERSION}.tar.bz2" 
curl -L http://files.teamspeak-services.com/releases/server/${TS_VERSION}/teamspeak3-server_linux_amd64-${TS_VERSION}.tar.bz2 | tar -xvj --strip-components=1
cp ./redist/libmariadb.so.2 ./