move logrotate.status to /var/lib/logrotate and add it to rwtab.d (#1127415)

This commit is contained in:
Jan Kaluza 2015-06-17 15:54:43 +02:00
parent 6d709f3d1f
commit 209cf3d9cd
3 changed files with 39 additions and 4 deletions

View File

@ -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]"

View File

@ -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 <jkaluza@redhat.com> - 3.9.1-2
- move logrotate.status to /var/lib/logrotate and add it to rwtab.d (#1127415)
* Fri Apr 03 2015 Jan Kaluza <jkaluza@redhat.com> - 3.9.1-1
- new upstream version 3.9.1

1
rwtab Normal file
View File

@ -0,0 +1 @@
dirs /var/lib/logrotate