Add upstream patch to fix buildroot issue

i9ce
Orion Poplawski 7 years ago
parent e4745ad53c
commit d6aa896d21

@ -0,0 +1,39 @@
From eac80966c503b0bc940c119d9a0adafb9ccf50d4 Mon Sep 17 00:00:00 2001
From: sebres <serg.brester@sebres.de>
Date: Fri, 24 Nov 2017 12:54:45 +0100
Subject: [PATCH] Fix scripts-root within `fail2ban.service` (relative install
root-base directory). This is amend for
e3b061e94b54067525c5e7f2ac716d1c838c9f20. Closes gh-1964
---
setup.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 11748778b..5dbd5b1ae 100755
--- a/setup.py
+++ b/setup.py
@@ -88,7 +88,13 @@ def get_outputs(self):
def update_scripts(self, dry_run=False):
buildroot = os.path.dirname(self.build_dir)
- print('Creating %s/fail2ban.service (from fail2ban.service.in): @BINDIR@ -> %s' % (buildroot, self.install_dir))
+ try:
+ root = self.distribution.command_options['install']['root'][1]
+ if self.install_dir.startswith(root):
+ install_dir = self.install_dir[len(root):]
+ except: # pragma: no cover
+ print('WARNING: Cannot find root-base option, check the bin-path to fail2ban-scripts in "fail2ban.service".')
+ print('Creating %s/fail2ban.service (from fail2ban.service.in): @BINDIR@ -> %s' % (buildroot, install_dir))
with open(os.path.join(source_dir, 'files/fail2ban.service.in'), 'r') as fn:
lines = fn.readlines()
fn = None
@@ -96,7 +102,7 @@ def update_scripts(self, dry_run=False):
fn = open(os.path.join(buildroot, 'fail2ban.service'), 'w')
try:
for ln in lines:
- ln = re.sub(r'@BINDIR@', lambda v: self.install_dir, ln)
+ ln = re.sub(r'@BINDIR@', lambda v: install_dir, ln)
if dry_run:
sys.stdout.write(' | ' + ln)
continue

@ -1,10 +1,13 @@
Summary: Daemon to ban hosts that cause multiple authentication errors
Name: fail2ban
Version: 0.10.1
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
URL: http://fail2ban.sourceforge.net/
Source0: https://github.com/%{name}/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Fix buildroot issue
# https://github.com/fail2ban/fail2ban/issues/1964
Patch0: https://github.com/fail2ban/fail2ban/commit/eac80966c503b0bc940c119d9a0adafb9ccf50d4.patch
#Source0: https://github.com/sebres/%{name}/archive/f2b-perfom-prepare-716-cs.tar.gz#/%{name}-test.tar.gz
# Give up being PartOf iptables for now
# https://bugzilla.redhat.com/show_bug.cgi?id=1379141
@ -156,6 +159,7 @@ by default.
%prep
%setup -q
%patch0 -p1
%patch2 -p1 -b .partof
%patch3 -p1 -b .sendmail
# Use Fedora paths
@ -298,6 +302,9 @@ fi
%changelog
* Sat Dec 30 2017 Orion Poplawski <orion@nwra.com> - 0.10.1-2
- Add upstream patch to fix buildroot issue
* Tue Nov 14 2017 Orion Poplawski <orion@cora.nwra.com> - 0.10.1-1
- Update to 0.10.1

Loading…
Cancel
Save