# Maintainer: Malte Rabenseifner <[email protected]>
# Adopted by: EnteEnteEnte <[email protected]>
# vim:set ts=2 sw=2 et:

pkgname="teamspeak3-server"
pkgver="3.0.10.1"
pkgrel=1
pkgdesc="A proprietary VoIP conference software"
arch=('i686' 'x86_64')

if [ "${CARCH}" == "x86_64" ]; then
_TSARCH='amd64'
_TSMD5='9d2f6b7674907967ba52c57d0151dcd3'
else
_TSARCH='x86'
_TSMD5='f92f01970871ab543208a39d00abe86e'
fi

url="http://www.teamspeak.com/"
license=('custom')
depends=('bash')
backup=('etc/conf.d/teamspeak3-server')
install="${pkgname}.install"
source=("http://teamspeak.gameserver.gamed.de/ts3/releases/${pkgver}/${pkgname}_linux-${_TSARCH}-${pkgver}.tar.gz"
'teamspeak3-server.conf.d'
'teamspeak3-server.service')
md5sums=(${_TSMD5}
'0c96de1dcdda230f5280aa30b5bb8084'
'deba6f1f72c12b366c06fa71e8461b33')

package() {
cd "${srcdir}"

install -d "${pkgdir}/usr/share/doc/${pkgname}"
install -d "${pkgdir}/usr/share/${pkgname}/sql"
install -dm 0750 "${pkgdir}/var/lib/${pkgname}"
install -dm 0750 "${pkgdir}/var/log/${pkgname}"

install -Dm 644 "${pkgname}.conf.d" "${pkgdir}/etc/conf.d/${pkgname}"
install -Dm 644 "${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"

install -Dm 644 "${pkgname}_linux-${_TSARCH}/libts3db_mysql.so" "${pkgdir}/usr/lib/libts3db_mysql.so"
install -Dm 644 "${pkgname}_linux-${_TSARCH}/libts3db_sqlite3.so" "${pkgdir}/usr/lib/libts3db_sqlite3.so"
install -Dm 755 "${pkgname}_linux-${_TSARCH}/ts3server_linux_${_TSARCH}" "${pkgdir}/usr/bin/${pkgname}"

cp -a "${pkgname}_linux-${_TSARCH}/sql/"* "${pkgdir}/usr/share/${pkgname}/sql"
cp -a "${pkgname}_linux-${_TSARCH}/doc/"* "${pkgdir}/usr/share/doc/${pkgname}"

install -Dm 644 "${pkgname}_linux-${_TSARCH}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}