File jitsi-videobridge.spec of Package jitsi-videobridge
#
# spec file for package jitsi-videobridge
#
# Copyright (c) 2020 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 group_name jitsi
%define short_name videobridge
%define user_name jvb
Name: jitsi-videobridge
Version: 2.0.10590
Release: 0
Summary: Jitsi Videobridge enables Jitsi-Meet to host multi user meetings
License: Apache-2.0
Group: Applications/Communications
URL: https://github.com/jitsi/jitsi-videobridge
Source0: jitsi-videobridge.tar.bz2
Source1: maven_repo.tar.bz2
Source2: jitsi-videobridge.service
Source3: jvb.conf
Source4: jitsi-videobridge_firewall.xml
Source6: %{short_name}-user.conf
%if 0%{?suse_version} > 1500
BuildRequires: alts
%endif
BuildRequires: maven
BuildRequires: firewall-macros
BuildRequires: unzip
BuildRequires: sysuser-tools
%sysusers_requires
Requires(post): sed
Requires(post): hostname
Requires: java-headless
BuildArch: noarch
%description
Jitsi Videobridge is a WebRTC compatible video router or SFU that lets build
highly scalable video conferencing infrastructure (i.e., up to hundreds of
conferences per server).
%prep
%autosetup -a1 -n %{name}
%build
mvn -nsu -o -e -DskipTests -Dmaven.repo.local=./maven_repo -Dassembly.skipAssembly=false clean package
%sysusers_generate_pre %{S:6} %{short_name}
%install
# systemd-sysusers
mkdir -p %{buildroot}%{_sysusersdir}/
install -m 0644 %{S:6} %{buildroot}%{_sysusersdir}/
# firewall config
install -D -m 644 %{S:4} %{buildroot}%{_prefix}/lib/firewalld/services/%{name}.xml
# Extract source
mkdir -p %{buildroot}%{_datadir}/%{group_name}/%{short_name}
unzip -qq jvb/target/jitsi-videobridge-*-SNAPSHOT-archive.zip -d %{buildroot}%{_datadir}/%{group_name}/%{short_name}
mv %{buildroot}%{_datadir}/%{group_name}/%{short_name}/jitsi-videobridge-*-SNAPSHOT/* %{buildroot}%{_datadir}/%{group_name}/%{short_name}
rm -r %{buildroot}%{_datadir}/%{group_name}/%{short_name}/jitsi-videobridge-*-SNAPSHOT
# Install systemd service
install -D -m 644 %{S:2} %{buildroot}%{_unitdir}/%{name}.service
mkdir -p %{buildroot}%{_sbindir}
ln -s service %{buildroot}%{_sbindir}/rc%{name}
# Remove M$ Windows script
rm %{buildroot}%{_datadir}/%{group_name}/%{short_name}/jvb.bat
# Install configs
install -D -T -m 0644 %{S:3} %{buildroot}%{_sysconfdir}/%{group_name}/%{short_name}/jvb.conf
%pre -f %{short_name}.pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%firewalld_reload
# Replace config values
if hostname -f ; then
sed -i "s/\${FQDN}/$(hostname -f)/g" %{_sysconfdir}/%{group_name}/%{short_name}/jvb.conf
else
echo "You still need to setup your Fully-Qualified Domain Name"
fi
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%{_sysusersdir}/%{short_name}-user.conf
%{_datadir}/%{group_name}
%dir %{_prefix}/lib/firewalld
%dir %{_prefix}/lib/firewalld/services
%{_prefix}/lib/firewalld/services/%{name}.xml
%attr(-,%{user_name},%{group_name}) %{_datadir}/%{group_name}/%{short_name}
%{_unitdir}/%{name}.service
%{_sbindir}/rc%{name}
%dir %{_sysconfdir}/%{group_name}
%dir %attr(-,%{user_name},%{group_name}) %{_sysconfdir}/%{group_name}/%{short_name}
%config(noreplace) %attr(-,%{user_name},%{group_name}) %{_sysconfdir}/%{group_name}/%{short_name}/jvb.conf
%license LICENSE
%doc README.md
%changelog