[packages/fail2ban] - package ghost log file and added logrotate config

baggins baggins at pld-linux.org
Mon Jan 6 21:03:35 CET 2014


commit 06aca71dd5a548d98cd441a7a497bbf3f17d1ae6
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon Jan 6 20:31:37 2014 +0100

    - package ghost log file and added logrotate config

 fail2ban.logrotate |  8 ++++++++
 fail2ban.spec      | 15 +++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/fail2ban.spec b/fail2ban.spec
index dddd702..2efe850 100644
--- a/fail2ban.spec
+++ b/fail2ban.spec
@@ -8,6 +8,7 @@ Group:		Daemons
 Source0:	http://download.sourceforge.net/fail2ban/%{name}-%{version}.tar.gz
 # Source0-md5:	2182a21c7efd885f373ffc941d11914d
 Source1:	%{name}.init
+Source2:	%{name}.logrotate
 Patch0:		ipv6.patch
 Patch1:		private-scriptdir.patch
 URL:		http://fail2ban.sourceforge.net/
@@ -50,8 +51,8 @@ sed -i -e 's|@@SCRIPTDIR@@|"%{py_sitescriptdir}/%{name}"|' fail2ban-{client,rege
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
-	$RPM_BUILD_ROOT%{_mandir}/man1 \
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,logrotate.d} \
+	$RPM_BUILD_ROOT{%{_mandir}/man1,/var/log} \
 	$RPM_BUILD_ROOT{%{systemdunitdir},%{systemdtmpfilesdir}}
 
 %{__python} setup.py install \
@@ -59,12 +60,16 @@ install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
 	--install-lib=%{py_sitescriptdir}/%{name} \
 	--root=$RPM_BUILD_ROOT
 
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/fail2ban
-install man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
+install -p man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
+
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/fail2ban
+install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/fail2ban
 
 install -p files/fail2ban-tmpfiles.conf $RPM_BUILD_ROOT%{systemdtmpfilesdir}/fail2ban.conf
 install -p files/fail2ban.service $RPM_BUILD_ROOT%{systemdunitdir}/fail2ban.service
 
+:> $RPM_BUILD_ROOT/var/log/fail2ban.log
+
 %py_postclean
 
 %clean
@@ -106,8 +111,10 @@ fi
 %dir %{_sysconfdir}/fail2ban/jail.d
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/*.conf
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fail2ban/*/*.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/fail2ban
 %{py_sitescriptdir}/%{name}
 %{_mandir}/man1/fail2ban-client.1*
 %{_mandir}/man1/fail2ban-regex.1*
 %{_mandir}/man1/fail2ban-server.1*
 %{_mandir}/man1/fail2ban.1*
+%attr(640,root,logs) %ghost /var/log/fail2ban.log
diff --git a/fail2ban.logrotate b/fail2ban.logrotate
new file mode 100644
index 0000000..65f78c9
--- /dev/null
+++ b/fail2ban.logrotate
@@ -0,0 +1,8 @@
+/var/log/fail2ban.log {
+	missingok
+	notifempty
+	create 640 root logs
+	postrotate
+		/usr/bin/fail2ban-client set logtarget /var/log/fail2ban.log 2>/dev/null || true
+	endscript
+}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/fail2ban.git/commitdiff/47c24e99b565dd110b23ae0681d14a78b86c19b6



More information about the pld-cvs-commit mailing list