Resolves: #1381719 - make /var/lib/logrotate/logrotate.status the default state file
This commit is contained in:
parent
bd1563184a
commit
3799546edf
90
logrotate-3.10.0-state-file-path.patch
Normal file
90
logrotate-3.10.0-state-file-path.patch
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
From eba6c5376e707d2ca0b9c40ea2387c19e8db1c5c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
Date: Wed, 23 Nov 2016 17:55:20 +0100
|
||||||
|
Subject: [PATCH] configure --with-state-file: specify default state file
|
||||||
|
|
||||||
|
Closes #85
|
||||||
|
|
||||||
|
Upstream-commit: 72827266598b7c1c58e785069e955dea3523cc59
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
config.h | 6 +++---
|
||||||
|
configure.ac | 17 +++++++++++++++++
|
||||||
|
logrotate.8 | 2 +-
|
||||||
|
3 files changed, 21 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.h b/config.h
|
||||||
|
index d715c5a..6740878 100644
|
||||||
|
--- a/config.h
|
||||||
|
+++ b/config.h
|
||||||
|
@@ -8,23 +8,23 @@
|
||||||
|
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
|
||||||
|
#define COMPRESS_COMMAND "/usr/contrib/bin/gzip"
|
||||||
|
#define UNCOMPRESS_COMMAND "/usr/contrib/bin/gunzip"
|
||||||
|
+#ifndef STATEFILE
|
||||||
|
#define STATEFILE "/var/run/logrotate.status"
|
||||||
|
+#endif /* STATEFILE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SunOS
|
||||||
|
#define DEFAULT_MAIL_COMMAND "/usr/bin/mailx"
|
||||||
|
-#define STATEFILE "/var/log/logrotate.status"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
#define DEFAULT_MAIL_COMMAND "/usr/bin/mail -s"
|
||||||
|
#define COMPRESS_COMMAND "/usr/bin/gzip"
|
||||||
|
#define UNCOMPRESS_COMMAND "/usr/bin/gunzip"
|
||||||
|
-#define STATEFILE "/var/log/logrotate.status"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
- * Default settings for Linux - leave these last.
|
||||||
|
+ * Default settings (mainly for Linux) - leave these last.
|
||||||
|
*/
|
||||||
|
#ifndef DEFAULT_MAIL_COMMAND
|
||||||
|
#define DEFAULT_MAIL_COMMAND "/bin/mail"
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index a6580f1..63c016c 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -40,6 +40,23 @@ AS_CASE(["$with_acl"],
|
||||||
|
AS_IF([test "$ac_cv_lib_acl_acl_get_file" = yes],
|
||||||
|
echo "1" > ./test/test.ACL;, echo "0" > ./test/test.ACL;)
|
||||||
|
|
||||||
|
+AC_ARG_WITH([state-file-path],
|
||||||
|
+ AC_HELP_STRING([--with-state-file-path=PATH],
|
||||||
|
+ [path to state file (/var/lib/logrotate.status by default)]),
|
||||||
|
+ [
|
||||||
|
+ case "$withval" in
|
||||||
|
+ yes|no)
|
||||||
|
+ AC_MSG_ERROR([--with-state-file-path=PATH requires a path to be specified])
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ STATE_FILE_PATH="$withval"
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ ],
|
||||||
|
+ [
|
||||||
|
+ STATE_FILE_PATH="/var/lib/logrotate.status"
|
||||||
|
+ ])
|
||||||
|
+AC_DEFINE_UNQUOTED([STATEFILE], "$STATE_FILE_PATH")
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS([strptime qsort fork vfork madvise vsyslog])
|
||||||
|
|
||||||
|
diff --git a/logrotate.8 b/logrotate.8
|
||||||
|
index 3f30472..77fdd4b 100644
|
||||||
|
--- a/logrotate.8
|
||||||
|
+++ b/logrotate.8
|
||||||
|
@@ -558,7 +558,7 @@ Log files are rotated if the current year is not the same as the last rotation.
|
||||||
|
.SH FILES
|
||||||
|
.PD 0
|
||||||
|
.TP 27
|
||||||
|
-\fI/var/lib/logrotate.status\fR
|
||||||
|
+\fI/var/lib/logrotate/logrotate.status\fR
|
||||||
|
Default state file.
|
||||||
|
.TP 27
|
||||||
|
\fI/etc/logrotate.conf\fR
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
From 70a8b71fd9d4951e69d1c4116dc28d2e1873d0eb Mon Sep 17 00:00:00 2001
|
|
||||||
From: rpm-build <rpm-build>
|
|
||||||
Date: Wed, 3 Aug 2016 14:30:19 +0200
|
|
||||||
Subject: [PATCH] logrotate.cron: use /var/lib/logrotate/logrotate.status as
|
|
||||||
state file
|
|
||||||
|
|
||||||
Signed-off-by: rpm-build <rpm-build>
|
|
||||||
---
|
|
||||||
examples/logrotate.cron | 2 +-
|
|
||||||
logrotate.8 | 10 ++++++++--
|
|
||||||
2 files changed, 9 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
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.8 b/logrotate.8
|
|
||||||
index 3f30472..9c62dc8 100644
|
|
||||||
--- a/logrotate.8
|
|
||||||
+++ b/logrotate.8
|
|
||||||
@@ -66,6 +66,9 @@ and mail it to the recipient. The default mail command is \fB/bin/mail
|
|
||||||
Tells \fBlogrotate\fR to use an alternate state file. This is useful
|
|
||||||
if logrotate is being run as a different user for various sets of
|
|
||||||
log files. The default state file is \fI/var/lib/logrotate.status\fR.
|
|
||||||
+Note that logrotate cron job on Fedora overrides the default with
|
|
||||||
+\fI/var/lib/logrotate/logrotate.status\fR in order to support read-only
|
|
||||||
+mounted root file systems.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fB\-\-usage\fR
|
|
||||||
@@ -557,10 +560,13 @@ Log files are rotated if the current year is not the same as the last rotation.
|
|
||||||
|
|
||||||
.SH FILES
|
|
||||||
.PD 0
|
|
||||||
-.TP 27
|
|
||||||
+.TP 42
|
|
||||||
\fI/var/lib/logrotate.status\fR
|
|
||||||
Default state file.
|
|
||||||
-.TP 27
|
|
||||||
+.TP 42
|
|
||||||
+\fI/var/lib/logrotate/logrotate.status\fR
|
|
||||||
+Default state file used by logrotate cron job on Fedora.
|
|
||||||
+.TP 42
|
|
||||||
\fI/etc/logrotate.conf\fR
|
|
||||||
Configuration options.
|
|
||||||
|
|
||||||
--
|
|
||||||
2.5.5
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
|||||||
Summary: Rotates, compresses, removes and mails system log files
|
Summary: Rotates, compresses, removes and mails system log files
|
||||||
Name: logrotate
|
Name: logrotate
|
||||||
Version: 3.10.0
|
Version: 3.10.0
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
License: GPL+
|
License: GPL+
|
||||||
Url: https://github.com/logrotate/logrotate
|
Url: https://github.com/logrotate/logrotate
|
||||||
Source: https://github.com/logrotate/logrotate/releases/download/%{version}/logrotate-%{version}.tar.xz
|
Source: https://github.com/logrotate/logrotate/releases/download/%{version}/logrotate-%{version}.tar.xz
|
||||||
Source1: rwtab
|
Source1: rwtab
|
||||||
|
|
||||||
# Change the location of status file
|
# implement the --with-state-file-path option of configure (upstream patch)
|
||||||
Patch0: logrotate-3.9.1-statusfile.patch
|
Patch0: logrotate-3.10.0-state-file-path.patch
|
||||||
|
|
||||||
BuildRequires: acl
|
BuildRequires: acl
|
||||||
|
BuildRequires: automake
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: libacl-devel
|
BuildRequires: libacl-devel
|
||||||
BuildRequires: libselinux-devel
|
BuildRequires: libselinux-devel
|
||||||
@ -31,8 +32,17 @@ log files on your system.
|
|||||||
%prep
|
%prep
|
||||||
%autosetup -S git
|
%autosetup -S git
|
||||||
|
|
||||||
|
printf "/autom4te.cache\n" >> .gitignore
|
||||||
|
git add .gitignore
|
||||||
|
git commit -m "update .gitignore"
|
||||||
|
|
||||||
|
autoreconf -fiv
|
||||||
|
git add configure
|
||||||
|
git checkout INSTALL
|
||||||
|
git commit -m "regenerate ./configure"
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure
|
%configure --with-state-file-path=%{_localstatedir}/lib/logrotate/logrotate.status
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
@ -47,7 +57,6 @@ mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate
|
|||||||
|
|
||||||
install -p -m 644 examples/logrotate-default $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.conf
|
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
|
install -p -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/logrotate
|
||||||
touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate/logrotate.status
|
|
||||||
|
|
||||||
# Make sure logrotate is able to run on read-only root
|
# Make sure logrotate is able to run on read-only root
|
||||||
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rwtab.d
|
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rwtab.d
|
||||||
@ -78,6 +87,9 @@ fi
|
|||||||
%config(noreplace) %{_sysconfdir}/rwtab.d/logrotate
|
%config(noreplace) %{_sysconfdir}/rwtab.d/logrotate
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 24 2016 Kamil Dudka <kdudka@redhat.com> - 3.10.0-4
|
||||||
|
- make /var/lib/logrotate/logrotate.status the default state file (#1381719)
|
||||||
|
|
||||||
* Fri Nov 11 2016 Kamil Dudka <kdudka@redhat.com> - 3.10.0-3
|
* Fri Nov 11 2016 Kamil Dudka <kdudka@redhat.com> - 3.10.0-3
|
||||||
- fix migration of state file from its previous location (#1393247)
|
- fix migration of state file from its previous location (#1393247)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user