File teamspeak3-server.spec of Package teamspeak3-server
#
# spec file for package teamspeak3-server
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define shortname teamspeak3
%define tsDNS %{shortname}-tsdns
%define tsBackup %{shortname}-backup
%define tsSQLite %{shortname}-sqlite
%define tsMariaDB %{shortname}-mariadb
%define tsPostgreSQL %{shortname}-postgresql
%define _dbdir %{_localstatedir}/lib/%{name}
%define _log_dir %{_localstatedir}/log/%{name}
%define _firewalldir %{_prefix}/lib/firewalld/services
%define _user teamspeak
%if 0%{?suse_version} > 1500
%define _confdir %{_distconfdir}
%else
%define _confdir %{_sysconfdir}
%endif
%ifarch x86_64
%define _tgzarch amd64
%else
%define _tgzarch x86
%endif
Name: %{shortname}-server
Version: 3.13.7
Release: 0
Summary: A proprietary VOIP server
License: NonFree
Group: Productivity/Telephony/Servers
URL: https://www.teamspeak.com/
Source0: https://files.teamspeak-services.com/releases/server/%{version}/%{name}_%{_target_os}_%{_tgzarch}-%{version}.tar.bz2
Source1: query_ip_allowlist.txt
Source2: query_ip_denylist.txt
Source3: %{name}.xml
Source4: %{name}.service
Source5: %{name}-rpmlintrc
Source20: README.SUSE.md
Source21: %{name}query.xml
Source23: ts3server.tmpfiles.d
Source24: ts3server.logrotate
BuildRequires: chrpath
BuildRequires: fdupes
BuildRequires: firewall-macros
BuildRequires: sysuser-tools
Requires: user(%{_user})
Recommends: logrotate
Recommends: %{tsSQLite}
Suggests: %{tsDNS}
Suggests: %{tsMariaDB}
Suggests: %{tsPostgreSQL}
ExclusiveArch: x86_64 %{ix86}
%description
The Teamspeak 3 VOIP server. It's free for limited use. See license
agreement for further information. TeamSpeak enables people to speak
with one another over the Internet. TeamSpeak is flexible, powerful,
scalable client-server software which results in an Internet based
conferencing solution which facilitates communication between users.
This package contains the server.
%package -n %{tsDNS}
Summary: Provides the Teamspeak 3 DNS
Source7: %{tsDNS}.xml
Source8: %{tsDNS}.service
Requires: %{name}
%description -n %{tsDNS}
TS DNS is a system that allows TeamSpeak users to connect to servers that are
running on arbitrary ports without having to specify the port. The "TSDNS name"
is used by the system to determine IP and Port. It can be compared to some
extent to the "Virtual Host" system of Apache in its purpose, though the
technical aspects are very much different.
%package -n %{tsSQLite}
Summary: SQLite support for the Teamspeak 3 server
Source6: ts3server.ini
Source16: ts3-reset-query-admin.sh
Requires: %{name}
Requires: sqlite >= 3.0
Recommends: %{tsBackup}
%description -n %{tsSQLite}
Config files and libraries for SQLite support in Teamspeak 3 server.
%package -n %{tsMariaDB}
Summary: MariaDB support for the Teamspeak 3 server
Source9: ts3server.ini.mariadb
Source10: ts3db_mariadb.ini
Requires: %{name}
Requires: libmariadb3
Suggests: mariadb
%description -n %{tsMariaDB}
Config files and libraries for MariaDB support in Teamspeak 3 server.
%package -n %{tsPostgreSQL}
Summary: PostgreSQL support for the Teamspeak 3 server
Source11: ts3server.ini.postgresql
Source12: ts3db_postgresql.ini
Requires: %{name}
Requires: postgresql
Suggests: postgresql-server
%description -n %{tsPostgreSQL}
Config files and libraries for PostgreSQL support in Teamspeak 3 server.
%package -n %{tsBackup}
Summary: Scripts for backing up the Teamspeak 3 server
Source13: snapshot
Source14: ts3snapshot
Source15: ts3backup
Source17: ts3-get-query-admin.sh
Source18: %{tsBackup}.service
Source19: %{tsBackup}.timer
Requires: %{name}
Requires: netcat
BuildArch: noarch
%description -n %{tsBackup}
Contributed scripts and a cron job to backup the Teamspeak server SQLite
database and create snapshots of all virtual server instances on a daily
basis.
%package -n system-user-%{_user}
Summary: System user %{_user} for %{name}
Source22: system-user-%{_user}.conf
BuildArch: noarch
%sysusers_requires
%description -n system-user-%{_user}
System user %{_user} for package %{name}
# no debug package for precompiled binaries
%global debug_package %{nil}
%prep
%autosetup -n %{name}_%{_target_os}_%{_tgzarch}
%build
%sysusers_generate_pre %{SOURCE22} %{_user} system-user-%{_user}.conf
%install
# user
install -m 644 -Dt %{buildroot}%{_sysusersdir} %{SOURCE22}
# libs
install -D -m 0755 -t %{buildroot}%{_libdir} *.so redist/libmariadb.so.2
# binary
# avoid binary-or-shlib-defines-rpath
chrpath --delete ts3server
install -D -t %{buildroot}%{_bindir} ts3server
# sql statement files
install -d %{buildroot}%{_datadir}/%{name}
cp -r sql %{buildroot}%{_datadir}/%{name}
# split sql files by the appropriate subpackages
find sql ! -type d | awk -F/ 'BEGIN{OFS=FS}\
{$1="%{_datadir}/%{name}/sql";\
if($0~/mariadb/){print>"sqlfiles-mariadb"}\
else if($0~/postgresql/) {print>"sqlfiles-postgresql"}\
else if($0~/sqlite/) {print>"sqlfiles-sqlite"}\
else {print>"sqlfiles"}}'
# teamspeak DNS
install -d -m 0755 %{buildroot}%{_confdir}/%{tsDNS}
install -D tsdns/tsdns_settings.ini.sample %{buildroot}%{_confdir}/%{tsDNS}/tsdns_settings.ini
install -D tsdns/tsdnsserver %{buildroot}%{_bindir}/tsdnsserver
# install service files
install -D -m 0644 -t %{buildroot}%{_unitdir} %{SOURCE4} %{SOURCE8} %{SOURCE18} %{SOURCE19}
# subdir for PID-file
install -D -m 0644 %{SOURCE23} %{buildroot}%{_tmpfilesdir}/%{name}.conf
# firewall config
install -D -m 0644 -t %{buildroot}%{_firewalldir} %{SOURCE3} %{SOURCE7} %{SOURCE21}
# config files
install -D -t %{buildroot}%{_confdir}/%{name} \
%{SOURCE1} %{SOURCE2} %{SOURCE6} %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13}
# logrotate
install -D -m 0644 %{SOURCE24} %{buildroot}%{_confdir}/logrotate.d/%{name}
install -d %{buildroot}%{_log_dir}
# rc symlink
install -d -m 0755 %{buildroot}/%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{tsDNS}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{tsBackup}
# backup and passwords scripts
install -t %{buildroot}%{_bindir} %{SOURCE14} %{SOURCE15} %{SOURCE16} %{SOURCE17}
install -D -d %{buildroot}%{_dbdir}/backups
install -d %{buildroot}%{_dbdir}/snapshots
# docs
mv serverquerydocs doc/serverquery
install -d %{buildroot}%{_defaultdocdir}/%{name}
mv doc/update_mysql_to_mariadb.txt %{buildroot}%{_defaultdocdir}/%{name}
install -m 0644 -t %{buildroot}%{_defaultdocdir}/%{name} %{SOURCE20}
%fdupes -s %{buildroot}
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%firewalld_reload
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
/sbin/ldconfig
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
/sbin/ldconfig
%pre -n %{tsDNS}
%service_add_pre %{tsDNS}.service
%post -n %{tsDNS}
%service_add_post %{tsDNS}.service
%firewalld_reload
%preun -n %{tsDNS}
%service_del_preun %{tsDNS}.service
%postun -n %{tsDNS}
%service_del_postun %{tsDNS}.service
%ldconfig_scriptlets -n %{tsSQLite}
%ldconfig_scriptlets -n %{tsMariaDB}
%ldconfig_scriptlets -n %{tsPostgreSQL}
%pre -n %{tsBackup}
%service_add_pre %{tsBackup}.service %{tsBackup}.timer
%post -n %{tsBackup}
%service_add_post %{tsBackup}.service %{tsBackup}.timer
%preun -n %{tsBackup}
%service_del_preun %{tsBackup}.service %{tsBackup}.timer
%postun -n %{tsBackup}
%service_del_postun %{tsBackup}.service %{tsBackup}.timer
%pre -n system-user-%{_user} -f %{_user}.pre
%files -f sqlfiles
%doc CHANGELOG doc/*
%doc %{_defaultdocdir}/%{name}/README.SUSE.md
%license LICENSE
%attr(0755,%{_user},root) %dir %{_dbdir}
%attr(0755,root,root) %{_bindir}/ts3server
%{_libdir}/libts3_ssh.so
%{_unitdir}/%{name}.service
%{_tmpfilesdir}/%{name}.conf
%{_sbindir}/rc%{name}
%dir %{_firewalldir}
%dir %{_prefix}/lib/firewalld
%{_firewalldir}/%{name}.xml
%{_firewalldir}/%{name}query.xml
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/sql
%attr(0755,%{_user},root) %dir %{_confdir}/%{name}
%attr(0644,%{_user},%{_user}) %config(noreplace) %{_confdir}/%{name}/query_ip_allowlist.txt
%attr(0644,%{_user},%{_user}) %config(noreplace) %{_confdir}/%{name}/query_ip_denylist.txt
%ghost %dir %attr(0755,%{_user},root) /run/ts3server
%ghost %attr(0640,%{_user},%{_user}) %{_confdir}/%{name}/ssh_host_rsa_key
%ghost %attr(0640,%{_user},%{_user}) %{_confdir}/%{name}/licensekey.dat
%ghost %attr(0644,%{_user},%{_user}) %{_confdir}/%{name}/serverkey.dat
%dir %attr(0755,%{_user},root) %{_log_dir}
%config(noreplace) %{_confdir}/logrotate.d/%{name}
%files -n %{tsDNS}
%doc tsdns/README tsdns/USAGE
%attr(0755,root,root) %{_bindir}/tsdnsserver
%attr(0755,root,root) %dir %{_confdir}/%{tsDNS}
%attr(0644,root,root) %config(noreplace) %{_confdir}/%{tsDNS}/tsdns_settings.ini
%{_unitdir}/%{tsDNS}.service
%{_firewalldir}/%{tsDNS}.xml
%{_sbindir}/rc%{tsDNS}
%files -n %{tsSQLite} -f sqlfiles-sqlite
%attr(0644,root,root) %config(noreplace) %{_confdir}/%{name}/ts3server.ini
%dir %{_datadir}/%{name}/sql/create_sqlite
%{_libdir}/libts3db_sqlite3.so
%attr(0755,root,root) %{_bindir}/ts3-reset-query-admin.sh
%files -n %{tsMariaDB} -f sqlfiles-mariadb
%attr(0644,root,%{_user}) %{_confdir}/%{name}/ts3server.ini.mariadb
%attr(0640,root,%{_user}) %config(noreplace) %{_confdir}/%{name}/ts3db_mariadb.ini
%dir %{_datadir}/%{name}/sql/create_mariadb
%dir %{_datadir}/%{name}/sql/updates_and_fixes
%{_libdir}/libts3db_mariadb.so
%doc %{_defaultdocdir}/%{name}/update_mysql_to_mariadb.txt
# redirstributable obsolete MariaDB client library
%{_libdir}/libmariadb.so.2
%files -n %{tsPostgreSQL} -f sqlfiles-postgresql
%attr(0644,root,%{_user}) %{_confdir}/%{name}/ts3server.ini.postgresql
%attr(0640,root,%{_user}) %config(noreplace) %{_confdir}/%{name}/ts3db_postgresql.ini
%dir %{_datadir}/%{name}/sql/create_postgresql
%{_libdir}/libts3db_postgresql.so
%files -n %{tsBackup}
%attr(0755,root,root) %{_bindir}/ts3snapshot
%attr(0755,root,root) %{_bindir}/ts3backup
%attr(0640,root,%{_user}) %config(noreplace) %{_confdir}/%{name}/snapshot
%attr(0755,%{_user},%{_user}) %dir %{_dbdir}/backups
%attr(0755,%{_user},%{_user}) %dir %{_dbdir}/snapshots
%attr(0755,root,root) %{_bindir}/ts3-get-query-admin.sh
%{_unitdir}/%{tsBackup}.service
%{_unitdir}/%{tsBackup}.timer
%{_sbindir}/rc%{tsBackup}
%files -n system-user-%{_user}
%{_sysusersdir}/system-user-%{_user}.conf
%changelog