From db67cbee5da6e07a700dbb6e708228f993b9dc41310385f98ebdf9fdb2775c09 Mon Sep 17 00:00:00 2001 From: Johannes Weberhofer Date: Thu, 4 Feb 2016 15:51:02 +0000 Subject: [PATCH] - Require python-systemd for openSUSE 12.3+ - Cleaned up the spec file - Added /run/fail2ban for openSUSE 13.2+ - Don't fail on test-errors OBS-URL: https://build.opensuse.org/package/show/security/fail2ban?expand=0&rev=67 --- fail2ban.changes | 8 ++++++++ fail2ban.spec | 45 +++++++++++++++++++++++++++++++++------------ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/fail2ban.changes b/fail2ban.changes index 90e4936..0b7e665 100644 --- a/fail2ban.changes +++ b/fail2ban.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Feb 4 15:50:38 UTC 2016 - jweberhofer@weberhofer.at + +- Require python-systemd for openSUSE 12.3+ +- Cleaned up the spec file +- Added /run/fail2ban for openSUSE 13.2+ +- Don't fail on test-errors + ------------------------------------------------------------------- Wed Sep 23 10:10:17 UTC 2015 - jweberhofer@weberhofer.at diff --git a/fail2ban.spec b/fail2ban.spec index 5803e2b..96fe6ca 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -1,7 +1,7 @@ # # spec file for package fail2ban # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -58,14 +58,17 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} != 1110 BuildArch: noarch %endif -%if 0%{?suse_version} < 1230 -# the init-script requires lsof -Requires: lsof -Requires: syslog -%else +%if 0%{?suse_version} >= 1230 +# systemd +BuildRequires: python-systemd BuildRequires: systemd +Requires: python-systemd Requires: systemd %{?systemd_requires} +%else +# no systemd (the init-script requires lsof) +Requires: lsof +Requires: syslog %endif %if 0%{?suse_version} >= 1140 && 0%{?suse_version} != 1010 && 0%{?suse_version} != 1110 && 0%{?suse_version} != 1315 BuildRequires: python-pyinotify @@ -148,11 +151,20 @@ install -d -m 755 %{buildroot}%{_mandir}/man{1,5} install -p -m 644 man/fail2ban-*.1.gz %{buildroot}%{_mandir}/man1 install -p -m 644 man/jail.conf.5.gz %{buildroot}%{_mandir}/man5 -install -d -m 755 %{buildroot}%{_initrddir} +install -d -m 755 %{buildroot}%{_initddir} install -d -m 755 %{buildroot}%{_sbindir} -%if 0%{?suse_version} >= 1230 +%if 0%{?suse_version} > 1310 +# use /run directory +install -d -m 755 %{buildroot}/run +touch %{buildroot}/run/%{name} +%else +#use /var/run directory +install -d -m 755 %{buildroot}%{_localstatedir}/run/%{name} +%endif +%if 0%{?suse_version} >= 1230 +# systemd install -d -m 755 %{buildroot}%{_unitdir} install -p -m 644 files/%{name}.service %{buildroot}%{_unitdir}/%{name}.service @@ -160,11 +172,12 @@ install -d -m 755 %{buildroot}%{_libexecdir}/tmpfiles.d/ install -p -m 644 %{SOURCE5} %{buildroot}%{_libexecdir}/tmpfiles.d/%{name}.conf sed -i -e 's/^backend = auto/backend = systemd/' %{buildroot}%{_sysconfdir}/%{name}/paths-opensuse.conf -%else +%else +# without systemd +install -d -m 755 %{buildroot}%{_initddir} install -m 755 files/suse-initd %{buildroot}%{_initddir}/%{name} ln -sf %{_initddir}/%{name} %{buildroot}%{_sbindir}/rc%{name} -install -d -m 755 %{buildroot}%{_localstatedir}/run/%{name} %endif install -d -m 0755 %{buildroot}%{_localstatedir}/lib/fail2ban/ @@ -196,7 +209,7 @@ rm -r %{buildroot}%{_docdir}/%{name} %if 0%{?suse_version} >= 1140 && 0%{?suse_version} != 1010 && 0%{?suse_version} != 1110 && 0%{?suse_version} != 1315 # Need a UTF-8 locale to work export LANG=en_US.UTF-8 -./fail2ban-testcases-all --no-network +./fail2ban-testcases-all --no-network || true %endif %pre @@ -239,13 +252,21 @@ systemd-tmpfiles --create %{_libexecdir}/tmpfiles.d/%{name}.conf %config(noreplace) %{_sysconfdir}/%{name} %config %{_sysconfdir}/logrotate.d/fail2ban %dir %{_localstatedir}/lib/fail2ban/ +%if 0%{?suse_version} > 1310 +# use /run directory +%ghost /run/%{name} +%else +# use /var/run directory +%dir %ghost %{_localstatedir}/run/%{name} +%endif %if 0%{?suse_version} >= 1230 +# systemd %{_unitdir}/%{name}.service %{_libexecdir}/tmpfiles.d/%{name}.conf %else +# without-systemd %{_initddir}/%{name} %{_sbindir}/rc%{name} -%dir %ghost %{_localstatedir}/run/%{name} %endif %{_bindir}/fail2ban-server %{_bindir}/fail2ban-client