From 209cf3d9cd1b1972bfa0020e7bae30068c0ec7dd Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Wed, 17 Jun 2015 15:54:43 +0200 Subject: [PATCH] move logrotate.status to /var/lib/logrotate and add it to rwtab.d (#1127415) --- logrotate-3.9.1-statusfile.patch | 12 ++++++++++++ logrotate.spec | 30 ++++++++++++++++++++++++++---- rwtab | 1 + 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 logrotate-3.9.1-statusfile.patch create mode 100644 rwtab diff --git a/logrotate-3.9.1-statusfile.patch b/logrotate-3.9.1-statusfile.patch new file mode 100644 index 0000000..1610173 --- /dev/null +++ b/logrotate-3.9.1-statusfile.patch @@ -0,0 +1,12 @@ +diff --git a/examples/logrotate.cron b/examples/logrotate.cron +index c6d50d4..967932e 100644 +--- a/examples/logrotate.cron ++++ b/examples/logrotate.cron +@@ -1,6 +1,6 @@ + #!/bin/sh + +-/usr/sbin/logrotate /etc/logrotate.conf ++/usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf + EXITVALUE=$? + if [ $EXITVALUE != 0 ]; then + /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]" diff --git a/logrotate.spec b/logrotate.spec index 71f7b4c..6a51978 100644 --- a/logrotate.spec +++ b/logrotate.spec @@ -1,11 +1,14 @@ Summary: Rotates, compresses, removes and mails system log files Name: logrotate Version: 3.9.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL+ Group: System Environment/Base Url: https://fedorahosted.org/logrotate/ Source: https://fedorahosted.org/releases/l/o/logrotate/logrotate-%{version}.tar.gz +Source1: rwtab +# Change the location of status file +Patch0: logrotate-3.9.1-statusfile.patch Requires: coreutils >= 5.92 popt BuildRequires: libselinux-devel popt-devel libacl-devel acl @@ -25,6 +28,7 @@ log files on your system. %prep %setup -q +%patch0 -p1 -b .statusfile %build export CFLAGS="$RPM_OPT_FLAGS" @@ -41,11 +45,25 @@ rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily -mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib +mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate install -p -m 644 examples/logrotate-default $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.conf install -p -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/logrotate -touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate.status +touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate/logrotate.status + +# Make sure logrotate is able to run on read-only root +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rwtab.d +install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/logrotate + +%pre +# If /var/lib/logrotate/logrotate.status does not exist, create it and copy +# the /var/lib/logrotate.status in it (if it exists). We have to do that in pre +# script, otherwise the /var/lib/logrotate/logrotate.status would not be there, +# because during the update, it is removed/renamed. +if [ ! -d %{_localstatedir}/lib/logrotate/ -a -f %{_localstatedir}/lib/logrotate.status ]; then + mkdir -p %{_localstatedir}/lib/logrotate + cp -a %{_localstatedir}/lib/logrotate.status %{_localstatedir}/lib/logrotate +fi %clean rm -rf $RPM_BUILD_ROOT @@ -61,9 +79,13 @@ rm -rf $RPM_BUILD_ROOT %attr(0755, root, root) %{_sysconfdir}/cron.daily/logrotate %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/logrotate.conf %attr(0755, root, root) %dir %{_sysconfdir}/logrotate.d -%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status +%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate/logrotate.status +%config(noreplace) %{_sysconfdir}/rwtab.d/logrotate %changelog +* Wed Jun 17 2015 Jan Kaluza - 3.9.1-2 +- move logrotate.status to /var/lib/logrotate and add it to rwtab.d (#1127415) + * Fri Apr 03 2015 Jan Kaluza - 3.9.1-1 - new upstream version 3.9.1 diff --git a/rwtab b/rwtab new file mode 100644 index 0000000..3210e47 --- /dev/null +++ b/rwtab @@ -0,0 +1 @@ +dirs /var/lib/logrotate