%if 0%{?fedora} >= 29 # disable bytecompile automagic %global _python_bytecompile_extra 0 %else # bytecompile files in %%{_datadir} with /usr/bin/python2, not /usr/bin/python %global __python %{__python2} %endif Name: sabnzbd Version: 2.3.9 Release: 1%{?dist} Summary: Automated Usenet download tool License: GPLv2+ URL: https://sabnzbd.org Source0: https://github.com/sabnzbd/sabnzbd/releases/download/%{version}/SABnzbd-%{version}-src.tar.gz Source1: sabnzbd.ini Source2: sabnzbd.service Source3: sabnzbd.user.service Source4: sabnzbd.logrotate BuildArch: noarch BuildRequires: python2-devel BuildRequires: systemd %{?systemd_requires} Requires: logrotate Requires: par2cmdline Requires: unrar Requires: python%{?fedora:2}-cheetah Requires: python2-sabyenc %if %{defined fedora} Recommends: p7zip Recommends: unzip Recommends: python2-cryptography Recommends: python2-pyOpenSSL %endif %description SABnzbd is an Open Source Binary Newsreader written in Python. It's totally free, incredibly easy to use, and works practically everywhere. SABnzbd makes Usenet as simple and streamlined as possible by automating everything we can. All you have to do is add an .nzb. SABnzbd takes over from there, where it will be automatically downloaded, verified, repaired, extracted and filed away with zero human interaction. %prep %autosetup -n SABnzbd-%{version} # remove Windows things rm sabnzbd/sabtray.py sabnzbd/utils/systrayiconthread.py licenses/License-systrayicon.txt %install install -d %{buildroot}%{_datadir}/sabnzbd cp -r cherrypy %{buildroot}%{_datadir}/sabnzbd cp -r email %{buildroot}%{_datadir}/sabnzbd cp -r gntp %{buildroot}%{_datadir}/sabnzbd cp -r icons %{buildroot}%{_datadir}/sabnzbd cp -r interfaces %{buildroot}%{_datadir}/sabnzbd cp -r sabnzbd %{buildroot}%{_datadir}/sabnzbd cp -r six %{buildroot}%{_datadir}/sabnzbd cp -r util %{buildroot}%{_datadir}/sabnzbd install -p -m 644 SABnzbd.py %{buildroot}%{_datadir}/sabnzbd %if 0%{?fedora} >= 29 # manually invoke bytecompile macro %py_byte_compile %{__python2} %{buildroot}%{_datadir}/sabnzbd %endif install -d -m 750 %{buildroot}%{_sharedstatedir}/sabnzbd install -d -m 750 %{buildroot}%{_sharedstatedir}/sabnzbd/admin install -d -m 750 %{buildroot}%{_sharedstatedir}/sabnzbd/autostart install -d -m 750 %{buildroot}%{_sharedstatedir}/sabnzbd/incomplete install -d -m 750 %{buildroot}%{_sharedstatedir}/sabnzbd/complete install -d -m 750 %{buildroot}%{_localstatedir}/log/sabnzbd install -D -p -m 660 %{S:1} %{buildroot}%{_sysconfdir}/sabnzbd/sabnzbd.ini install -D -p -m 644 %{S:2} %{buildroot}%{_unitdir}/sabnzbd.service install -D -p -m 644 %{S:3} %{buildroot}%{_userunitdir}/sabnzbd.service install -D -p -m 644 %{S:4} %{buildroot}%{_sysconfdir}/logrotate.d/sabnzbd %pre getent group sabnzbd &> /dev/null || groupadd -r sabnzbd &> /dev/null getent passwd sabnzbd &> /dev/null || \ useradd -r -g sabnzbd -d %{_sharedstatedir}/sabnzbd -s /sbin/nologin \ -c 'SABnzbd' sabnzbd &> /dev/null exit 0 %post %systemd_post sabnzbd.service %systemd_user_post sabnzbd.service %preun %systemd_preun sabnzbd.service %systemd_user_preun sabnzbd.service %postun %systemd_postun_with_restart sabnzbd.service %systemd_user_postun_with_restart sabnzbd.service %files %license LICENSE.txt licenses/* # main application %{_datadir}/sabnzbd # persistance %dir %attr(0750, sabnzbd, sabnzbd) %{_sharedstatedir}/sabnzbd %dir %attr(0750, sabnzbd, sabnzbd) %{_sharedstatedir}/sabnzbd/admin # allow group write access to these %dir %attr(0770, sabnzbd, sabnzbd) %{_sharedstatedir}/sabnzbd/autostart %dir %attr(0770, sabnzbd, sabnzbd) %{_sharedstatedir}/sabnzbd/incomplete %dir %attr(0770, sabnzbd, sabnzbd) %{_sharedstatedir}/sabnzbd/complete # logs %dir %attr(0750, sabnzbd, sabnzbd) %{_localstatedir}/log/sabnzbd %config(noreplace) %{_sysconfdir}/logrotate.d/sabnzbd # config %dir %attr(0750, sabnzbd, sabnzbd) %{_sysconfdir}/sabnzbd %config(noreplace) %attr(0640, sabnzbd, sabnzbd) %{_sysconfdir}/sabnzbd/sabnzbd.ini %{_unitdir}/sabnzbd.service %{_userunitdir}/sabnzbd.service %changelog * Wed Aug 28 2019 Carl George - 2.3.9-1 - Latest upstream * Sat Mar 02 2019 Carl George - 2.3.7-1 - Latest upstream * Tue Oct 09 2018 Carl George - 2.3.5-1 - Latest upstream * Mon Jun 18 2018 Carl George - 2.3.4-2 - Update bytecompiling to comply with packaging guidelines * Sun Jun 17 2018 Carl George - 2.3.4-1 - Latest upstream * Mon May 14 2018 Carl George - 2.3.3-1 - Latest upstream * Fri Mar 02 2018 Carl George - 2.3.2-3 - Add systemd user unit * Wed Feb 28 2018 Carl George - 2.3.2-2 - Move config into /etc/sabnzbd subdirectory to allow app to write backup configs * Sun Feb 18 2018 Carl George - 2.3.2-1 - Initial package