File sabnzbd.spec of Package sabnzbd
Name: sabnzbd
Version: 4.5.2
Release: 0%{?dist}
Summary: SABnzbd - The automated Usenet download tool
License: GPL-2.0
URL: https://sabnzbd.org/
Source0: https://github.com/sabnzbd/sabnzbd/archive/%{version}/%{name}-%{version}.tar.gz
Source1: %{name}.service
Source2: %{name}-firewalld.xml
Source3: %{name}.ini
Patch0: SABnzbd.py.patch
%{?systemd_requires}
%if 0%{?suse_version}
BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
BuildRequires: firewalld
BuildRequires: firewall-macros
BuildRequires: %{pythons}
%if 0%{?suse_version} < 1600
%define python3 %{__python310}
BuildRequires: python310
%else
%define python3 %{__python3}
%endif
%else
BuildRequires: python3-devel
BuildRequires: pyproject-rpm-macros
BuildRequires: firewalld-filesystem
%endif
BuildRequires: systemd-rpm-macros
BuildRequires: fdupes
Requires: python3-apprise
Requires: python3-cheetah
Requires: python3-cherrypy
Requires: python3-cheroot
Requires: python3-chardet
Requires: python3-configobj
Requires: python3-dbus
Requires: python3-feedparser
Requires: python3-portend
Requires: python3-sabctools
Requires: python3-guessit
Requires: python3-puremagic
Requires: python3-pysocks
Requires: par2cmdline
Requires: p7zip
Requires: unrar
Requires: servarr-user
Requires: %{name}-firewalld
%global _build_id_links none
%description
SABnzbd - The automated Usenet download tool
%package firewalld
Summary: Firewalld configuration for Radarr
%description firewalld
firewalld configuration for Radarr
%global debug_package %{nil}
%prep
%autosetup
# Set python and data directory (templates etc.)
sed -i 's;@@python3@@;/usr/bin/python3;' SABnzbd.py
sed -i 's;@@DATADIR@@;%{_datarootdir}/%{name};' SABnzbd.py
# Set directories in default config
sed -i 's;@@DOWNLOADDIR@@;%{_sharedstatedir}/%{name};' %{SOURCE3}
sed -i 's;@@ADMINDIR@@;%{_sharedstatedir}/%{name};' %{SOURCE3}
sed -i 's;@@LOGDIR@@;%{_localstatedir}/log/%{name};' %{SOURCE3}
sed -i 's;@@CONFIGFILE@@;%{_sysconfdir}/%{name}/%{name}.ini;' %{SOURCE1}
%build
%{python3} tools/make_mo.py
%install
install -p -m 755 -D SABnzbd.py %{buildroot}%{_bindir}/SABnzbd.py
mkdir -p %{buildroot}%{python3_sitelib}/%{name}
cp -ar sabnzbd/* %{buildroot}%{python3_sitelib}/%{name}
chmod -R 755 %{buildroot}%{python3_sitelib}/%{name}
mkdir -p %{buildroot}%{_datarootdir}/%{name}
cp -ar email %{buildroot}%{_datarootdir}/%{name}
cp -ar icons %{buildroot}%{_datarootdir}/%{name}
cp -ar interfaces %{buildroot}%{_datarootdir}/%{name}
cp -ar locale %{buildroot}%{_datarootdir}/%{name}
cp -ar po %{buildroot}%{_datarootdir}/%{name}
cp -ar tools %{buildroot}%{_datarootdir}/%{name}
mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
# config
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
cp %{SOURCE3} %{buildroot}%{_sysconfdir}/%{name}/%{name}.ini
# log
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
# service
mkdir -p %{buildroot}%{_unitdir}
cp %{SOURCE1} %{buildroot}%{_unitdir}
# firewalld
install -p -m 644 -D %{SOURCE2} %{buildroot}%{_prefix}/lib/firewalld/services/%{name}.xml
%fdupes %{buildroot}/%{_prefix}
%if 0%{?suse_version}
%pre
%service_add_pre %{name}.service
%endif
%post
%if 0%{?suse_version}
%service_add_post %{name}.service
%else
%systemd_post %{name}.service
%endif
%preun
%if 0%{?suse_version}
%service_del_preun %{name}.service
%else
%systemd_preun %{name}.service
%endif
%postun
%if 0%{?suse_version}
%service_del_postun %{name}.service
%else
%systemd_postun %{name}.service
%endif
%files
%{_bindir}/SABnzbd.py
%{python3_sitelib}/%{name}
%{_unitdir}/%{name}.service
%attr(750,servarr,servarr)%dir %{_sharedstatedir}/%{name}
%{_datarootdir}/%{name}
%attr(750,servarr,servarr) %dir %{_sysconfdir}/%{name}
%attr(750,servarr,servarr) %config %{_sysconfdir}/%{name}/%{name}.ini
%attr(750,servarr,servarr) %dir %{_localstatedir}/log/%{name}
%files firewalld
%{_prefix}/lib/firewalld/services/%{name}.xml
%post firewalld
%firewalld_reload
%changelog
* Thu Jun 06 2024 Jonas Hucklenbroich <jonas@hucklenbroich.org> 4.3.2-2
- Change sabnzbd spec file to autosetup (jonas@hucklenbroich.org)
* Tue Jun 04 2024 Jonas Hucklenbroich <jonas@hucklenbroich.org> 4.3.2-1
- new package built with tito