aboutsummaryrefslogtreecommitdiff
blob: f2ae19bc6c29a9631b456c7b1aaa0d37411803f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-server-bin/teamspeak-server-bin-3.0.10.3.ebuild,v 1.2 2015/03/21 21:17:13 jlec Exp $

EAPI="5"

inherit eutils systemd user

DESCRIPTION="TeamSpeak Voice Communication Server"
HOMEPAGE="http://www.teamspeak.com/"
SRC_URI="
	amd64? ( http://files.teamspeak-services.com/releases/${PV}/teamspeak3-server_linux-amd64-${PV}.tar.gz )
	x86? ( http://files.teamspeak-services.com/releases/${PV}/teamspeak3-server_linux-x86-${PV}.tar.gz )"

SLOT="0"
LICENSE="teamspeak3 GPL-2"
IUSE="doc pdf systemd tsdns"
KEYWORDS="~amd64 ~x86"

RESTRICT="installsources mirror strip"

S="${WORKDIR}/teamspeak3-server_linux-${ARCH}"

pkg_setup() {
	enewuser teamspeak3
}

src_install() {
	local dir="/opt/teamspeak3"

	# Install TeamSpeak 3 server into $dir
	into "${dir}"

	dodoc -r CHANGELOG doc/*.txt
	use doc && dodoc -r serverquerydocs
	use pdf && dodoc doc/*.pdf

	# Install binary, wrapper, shell files and libraries.
	newsbin ts3server_linux_${ARCH} ts3server-bin
	# Standard package installs ts3server to /usr/sbin directory
	dobin "${FILESDIR}/ts3server"
	# Standard package installs scripts and libraries to /opt/teamspeak3-server directory
	dobin *.sh

	# 'dolib' may install to libx32 or lib64 - we just want 'lib' alone
	#dolib.so *.so
	insinto "${dir}"/lib
	doins *.so
	# 'libmysqlclient.so.15' is hard-coded into the ts3-server binary :(
	dosym "${EROOT}"/usr/$(get_libdir)/libmysqlclient.so "${dir}"/lib/libmysqlclient.so.15

	if use tsdns; then
		newdoc tsdns/README README.tsdns
		newdoc tsdns/USAGE USAGE.tsdns
		newsbin tsdns/tsdnsserver_linux_${ARCH} tsdnsserver
		# Standard package installs sample files as documentation
		insinto "${dir}"/sbin
		doins tsdns/tsdns_settings.ini.sample
	fi

	# Standard package installs sql directory to /opt/teamspeak3-server directory
	insinto "${dir}"/lib
	doins -r sql

	insinto /etc/teamspeak3
	doins "${FILESDIR}/server.conf"
	doins "${FILESDIR}/ts3db_mysql.ini"
	newinitd "${FILESDIR}/${PN}-3.0.7.2.rc" teamspeak3

	if use systemd; then
		systemd_dounit "${FILESDIR}/systemd/teamspeak3.service"
		systemd_dotmpfilesd "${FILESDIR}/systemd/teamspeak3.conf"
	fi

	keepdir /{etc,var/{lib,log,run}}/teamspeak3

	# Fix up permissions
	fowners teamspeak3 /{etc,var/{lib,log,run}}/teamspeak3
	fperms 700 /{etc,var/{lib,log,run}}/teamspeak3

	fowners teamspeak3 "${dir}"
	fperms 755 "${dir}"
}