Use systemd init for Fedora 19+ (bug #883158)

i9ce
Orion Poplawski 12 years ago
parent 680209bec5
commit 6bfd65edcf

@ -0,0 +1,12 @@
[Unit]
Description=Fail2ban Service
[Service]
Type=forking
ExecStart=/usr/bin/fail2ban-client -x start
ExecStop=/usr/bin/fail2ban-client stop
ExecReload=/usr/bin/fail2ban-client reload
Restart=always
[Install]
WantedBy=network.target

@ -1,13 +1,16 @@
Summary: Ban IPs that make too many password failures
Name: fail2ban
Version: 0.8.8
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
Group: System Environment/Daemons
URL: http://fail2ban.sourceforge.net/
Source0: https://github.com/downloads/%{name}/%{name}/%{name}_%{version}.orig.tar.gz
Source1: fail2ban-logrotate
Source2: fail2ban-tmpfiles.conf
%if 0%{?fedora} >= 19
Source3: fail2ban.service
%endif
Patch0: fail2ban-0.8.3-init.patch
Patch1: fail2ban-0.8.7.1-sshd.patch
# Do not use pam_unix failure messages to ban sshd
@ -32,10 +35,17 @@ BuildArch: noarch
Requires: iptables
Requires: gamin-python
Requires: python-inotify
%if 0%{?fedora} >= 19
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires: initscripts
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%endif
%description
Fail2ban scans log files like /var/log/pwdfail or
@ -63,8 +73,13 @@ python setup.py build
%install
rm -rf %{buildroot}
python setup.py install -O1 --root %{buildroot}
%if 0%{?fedora} >= 19
mkdir -p %{buildroot}%{_unitdir}
cp -p %SOURCE3 %{buildroot}%{_unitdir}/
%else
mkdir -p %{buildroot}%{_initddir}
install -p -m 755 files/redhat-initd %{buildroot}%{_initddir}/fail2ban
%endif
mkdir -p %{buildroot}%{_mandir}/man1
install -p -m 644 man/fail2ban*.1 %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
@ -82,13 +97,26 @@ install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/tmpfiles.d/fail2ban.conf
rm -rf %{buildroot}
%post
%if 0%{?fedora} >= 19
%systemd_post fail2ban.service
%else
/sbin/chkconfig --add %{name}
%endif
%preun
%if 0%{?fedora} >= 19
%systemd_preun fail2ban.service
%else
if [ $1 = 0 ]; then
/sbin/service %{name} stop > /dev/null 2>&1
/sbin/chkconfig --del %{name}
fi
%endif
%if 0%{?fedora} >= 19
%postun
%systemd_postun_with_restart fail2ban.service
%endif
%files
%defattr(-,root,root,-)
@ -98,7 +126,11 @@ fi
%{_bindir}/fail2ban-client
%{_bindir}/fail2ban-regex
%{_datadir}/fail2ban
%if 0%{?fedora} >= 19
%{_unitdir}/fail2ban.service
%else
%{_initddir}/fail2ban
%endif
%{_mandir}/man1/fail2ban-*.1*
%dir %{_sysconfdir}/fail2ban
%dir %{_sysconfdir}/fail2ban/action.d
@ -113,6 +145,9 @@ fi
%dir %{_localstatedir}/lib/fail2ban/
%changelog
* Fri Mar 15 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.8-4
- Use systemd init for Fedora 19+ (bug #883158)
* Thu Feb 14 2013 Orion Poplawski <orion@cora.nwra.com> - 0.8.8-3
- Add patch from upstream to fix module imports (Bug #892365)
- Add patch from upstream to UTF-8 characters in syslog (Bug #905097)

Loading…
Cancel
Save