File teamspeak3-client.spec of Package teamspeak3-client
%ifarch x86_64
%define _ts3_arch amd64
%else
%define _ts3_arch x86
%endif
Name: teamspeak3-client
Version: 3.6.2
Release: 3%{?dist}
License: NonFree
Group: Productivity/Networking/Talk/Clients
Url: http://www.teamspeak.com/
Summary: Teamspeak 3 Client
Source0: teamspeak3-client.desktop
Source1: ts3client_runscript.sh
ExclusiveArch: %{ix86} x86_64
BuildRequires: curl
BuildRequires: tar
BuildRequires: update-desktop-files
BuildRequires: -post-build-checks
Requires(post): shared-mime-info
Requires(post): desktop-file-utils
Requires(postun): shared-mime-info
Requires(postun): desktop-file-utils
%description
Teamspeak is a flexible, powerful, scalable software, which allows groups of
people to speak with one another over the internet.
Teamspeak is free of charge to non-profit entities and offers low cost, flexible
licensing options for commercial use.
%pre
# when upgrading copy the outdated version to a temporary directory and change the link while the upgrade is running
if [ $1 == 2 ];then
if [[ -d %{_libexecdir}/%{name} ]];then
echo "Found previous installation."
echo "Copy to new location %{_libexecdir}/%{name}_$1 and change link to %{_libexecdir}/%{name}_old/ts3client_runscript.sh -> %{_bindir}/%{name}."
cp -r %{_libexecdir}/%{name} %{_libexecdir}/%{name}_old
ln -s %{_libexecdir}/%{name}_old/ts3client_runscript.sh %{_bindir}/%{name}
rm -r %{_libexecdir}/%{name}
fi
fi
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libexecdir}/%{name}
install -D -m 0644 %{S:0} %{buildroot}%{_datadir}/applications/%{name}.desktop
install -D -m 0744 %{S:1} %{buildroot}%{_libexecdir}/%{name}/ts3client_runscript.sh
ln -s %{_libexecdir}/%{name}/ts3client_runscript.sh %{buildroot}%{_bindir}/%{name}
%suse_update_desktop_file %{name}
%post
echo "Downloading TeamSpeak 3 Client from https://teamspeak.com/en/downloads/ (version: %{version}; arch: %{_ts3_arch})"
curl -O https://files.teamspeak-services.com/releases/client/%{version}/TeamSpeak3-Client-linux_%{_ts3_arch}-%{version}.run
curl -O https://teamspeak.com/user/themes/teamspeak/images/favicon.png
echo "Installing TeamSpeak 3 Client"
sh ./TeamSpeak3-Client-linux_%{_ts3_arch}-%{version}.run --tar xf -C %{_libexecdir}/%{name}
rm ./TeamSpeak3-Client-linux_%{_ts3_arch}-%{version}.run
cp ./favicon.png %{_libexecdir}/%{name}/logo-256x256.png
# Fix permissions
find %{_libexecdir}/%{name} -type d | xargs chmod 755
find %{_libexecdir}/%{name} -type f | xargs chmod 644
find %{_libexecdir}/%{name} -name '*.so*' | xargs chmod 755
chmod +x %{_libexecdir}/%{name}/ts3client* %{_libexecdir}/%{name}/package_inst %{_libexecdir}/%{name}/QtWebEngineProcess
# when upgrading remove outdated version after linking to the new script
if [ $1 == 2 ];then
ln -s %{_libexecdir}/%{name}/ts3client_runscript.sh %{_bindir}/%{name}
if [[ -d %{_libexecdir}/%{name}_old ]];then
rm -r %{_libexecdir}/%{name}_old
fi
fi
%mime_database_post
%desktop_database_post
%postun
# when removing remove directory
if [ $1 == 0 ];then
rm -r %{_libexecdir}/%{name}
fi
%mime_database_postun
%desktop_database_postun
%files
%{_bindir}/%{name}
%{_libexecdir}/%{name}
%{_datadir}/applications/%{name}.desktop
%changelog