forked from pool/logrotate
Accepting request 1003701 from home:schubi2
- Ignoring vendor logs settings in /usr/etc/logrotate.d if they have already been defined by the the admin in the /etc/logrotate.d directory (bsc#1173319). OBS-URL: https://build.opensuse.org/request/show/1003701 OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=103
This commit is contained in:
parent
1618f9d36e
commit
7fe931ced3
@ -1,31 +0,0 @@
|
|||||||
diff -ur logrotate-3.20.0.orig/logrotate.8.in logrotate-3.20.0/logrotate.8.in
|
|
||||||
--- logrotate-3.20.0.orig/logrotate.8.in 2022-03-31 14:00:36.000000000 +0200
|
|
||||||
+++ logrotate-3.20.0/logrotate.8.in 2022-05-25 15:40:21.015424608 +0200
|
|
||||||
@@ -48,6 +48,17 @@
|
|
||||||
is given on the command line, every file in that directory is used as
|
|
||||||
a config file.
|
|
||||||
.P
|
|
||||||
+If \fBlogrotate\fR is called via \fBsystemd\fR(1), following order of
|
|
||||||
+parsed config files is defined in the \fIlogrotate.service\fR file:
|
|
||||||
+.TS
|
|
||||||
+tab(:);
|
|
||||||
+l l l.
|
|
||||||
+\fI/usr/etc/logrotate.conf\fR:Default configuration file defined by the vendor.
|
|
||||||
+\fI/usr/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the vendor.
|
|
||||||
+\fI/etc/logrotate.conf\fR:Default configuration file defined by the administrator. (optional)
|
|
||||||
+\fI/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the administrator. (optional)
|
|
||||||
+.TE
|
|
||||||
+.P
|
|
||||||
If no command line arguments are given, \fBlogrotate\fR will print
|
|
||||||
version and copyright information, along with a short usage summary. If
|
|
||||||
any errors occur while rotating logs, \fBlogrotate\fR will exit with
|
|
||||||
@@ -752,7 +763,8 @@
|
|
||||||
tab(:);
|
|
||||||
l l l.
|
|
||||||
\fI@STATE_FILE_PATH@\fR:Default state file.
|
|
||||||
-\fI/etc/logrotate.conf\fR:Configuration options.
|
|
||||||
+\fI/usr/etc/logrotate.conf\fR:Configuration options defined by the vendor.
|
|
||||||
+\fI/etc/logrotate.conf\fR:Configuration options defined by the administrator.
|
|
||||||
.TE
|
|
||||||
|
|
||||||
|
|
74
logrotate-vendor-dir.patch
Normal file
74
logrotate-vendor-dir.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
diff -Naur logrotate-3.20.1.org/config.c logrotate-3.20.1.patch/config.c
|
||||||
|
--- logrotate-3.20.1.org/config.c 2022-05-24 17:20:14.000000000 +0200
|
||||||
|
+++ logrotate-3.20.1.patch/config.c 2022-09-14 12:48:02.293003630 +0200
|
||||||
|
@@ -1847,11 +1847,19 @@
|
||||||
|
for (k = 0; k < log->numFiles; k++) {
|
||||||
|
if (!strcmp(log->files[k],
|
||||||
|
globResult.gl_pathv[glob_count])) {
|
||||||
|
- message(MESS_ERROR,
|
||||||
|
+#ifdef ENABLE_VENDORDIR
|
||||||
|
+ message(MESS_DEBUG,
|
||||||
|
+ "%s:%d duplicate log entry for %s --> ignoring\n",
|
||||||
|
+ configFile, lineNum,
|
||||||
|
+ globResult.gl_pathv[glob_count]);
|
||||||
|
+ state = STATE_SKIP_CONFIG;
|
||||||
|
+#else
|
||||||
|
+ message(MESS_ERROR,
|
||||||
|
"%s:%d duplicate log entry for %s\n",
|
||||||
|
configFile, lineNum,
|
||||||
|
globResult.gl_pathv[glob_count]);
|
||||||
|
- logerror = 1;
|
||||||
|
+ logerror = 1;
|
||||||
|
+#endif
|
||||||
|
goto duperror;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff -Naur logrotate-3.20.1.org/configure.ac logrotate-3.20.1.patch/configure.ac
|
||||||
|
--- logrotate-3.20.1.org/configure.ac 2021-07-27 10:25:23.000000000 +0200
|
||||||
|
+++ logrotate-3.20.1.patch/configure.ac 2022-09-14 13:49:13.052981225 +0200
|
||||||
|
@@ -58,6 +58,14 @@
|
||||||
|
AS_IF([test "$ac_cv_lib_acl_acl_get_file" = yes],
|
||||||
|
echo "1" > ./test/test.ACL; WITH_ACL="yes";, echo "0" > ./test/test.ACL;)
|
||||||
|
|
||||||
|
+AC_ARG_ENABLE([vendordir],
|
||||||
|
+ AS_HELP_STRING([--enable-vendordir],[ignore redefined logs; prefering user defined logs defintions]))
|
||||||
|
+
|
||||||
|
+if test x"$enable_vendordir" = x"yes" ; then
|
||||||
|
+ AC_DEFINE([ENABLE_VENDORDIR],,
|
||||||
|
+ [ignore redefined logs; prefering user defined logs defintions])
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
DEFAULT_MAIL_COMMAND="/bin/mail"
|
||||||
|
COMPRESS_COMMAND="/bin/gzip"
|
||||||
|
UNCOMPRESS_COMMAND="/bin/gunzip"
|
||||||
|
diff -Naur logrotate-3.20.1.org/logrotate.8.in logrotate-3.20.1.patch/logrotate.8.in
|
||||||
|
--- logrotate-3.20.1.org/logrotate.8.in 2022-03-31 14:00:36.000000000 +0200
|
||||||
|
+++ logrotate-3.20.1.patch/logrotate.8.in 2022-09-14 13:06:32.116996856 +0200
|
||||||
|
@@ -48,6 +48,17 @@
|
||||||
|
is given on the command line, every file in that directory is used as
|
||||||
|
a config file.
|
||||||
|
.P
|
||||||
|
+If \fBlogrotate\fR is called via \fBsystemd\fR(1), following order of
|
||||||
|
+parsed config files is defined in the \fIlogrotate.service\fR file:
|
||||||
|
+.TS
|
||||||
|
+tab(:);
|
||||||
|
+l l l.
|
||||||
|
+\fI/usr/etc/logrotate.conf\fR:Default configuration file defined by the vendor.
|
||||||
|
+\fI/usr/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the vendor.
|
||||||
|
+\fI/etc/logrotate.conf\fR:Default configuration file defined by the administrator. (optional)
|
||||||
|
+\fI/etc/logrotate.d/*\fR:Directory for additional configuration files defined by the administrator. (optional)
|
||||||
|
+.TE
|
||||||
|
+.P
|
||||||
|
If no command line arguments are given, \fBlogrotate\fR will print
|
||||||
|
version and copyright information, along with a short usage summary. If
|
||||||
|
any errors occur while rotating logs, \fBlogrotate\fR will exit with
|
||||||
|
@@ -752,7 +763,8 @@
|
||||||
|
tab(:);
|
||||||
|
l l l.
|
||||||
|
\fI@STATE_FILE_PATH@\fR:Default state file.
|
||||||
|
-\fI/etc/logrotate.conf\fR:Configuration options.
|
||||||
|
+\fI/usr/etc/logrotate.conf\fR:Configuration options defined by the vendor.
|
||||||
|
+\fI/etc/logrotate.conf\fR:Configuration options defined by the administrator.
|
||||||
|
.TE
|
||||||
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Sep 14 11:15:55 UTC 2022 - Stefan Schubert <schubi@suse.com>
|
||||||
|
|
||||||
|
- Ignoring vendor logs settings in /usr/etc/logrotate.d if they
|
||||||
|
have already been defined by the the admin in the /etc/logrotate.d
|
||||||
|
directory (bsc#1173319).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Jun 20 12:06:17 UTC 2022 - Stefan Schubert <schubi@suse.com>
|
Mon Jun 20 12:06:17 UTC 2022 - Stefan Schubert <schubi@suse.com>
|
||||||
|
|
||||||
|
@ -19,5 +19,5 @@ compress
|
|||||||
compresscmd /usr/bin/xz
|
compresscmd /usr/bin/xz
|
||||||
uncompresscmd /usr/bin/xzdec
|
uncompresscmd /usr/bin/xzdec
|
||||||
|
|
||||||
# RPM packages drop log rotation information into this directory
|
# Additinal location (directory or file) for rotation information
|
||||||
include /usr/etc/logrotate.d
|
# include <file_or_directory>
|
||||||
|
@ -8,9 +8,13 @@ ConditionACPower=true
|
|||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStartPre=/bin/sh -c "/usr/bin/systemctl set-environment etc_conf=" ; \
|
ExecStartPre=/bin/sh -c "/usr/bin/systemctl set-environment etc_conf=" ; \
|
||||||
/bin/sh -c "if [ -f /etc/logrotate.conf ]; then /usr/bin/systemctl set-environment etc_conf=/etc/logrotate.conf; fi" ; \
|
/bin/sh -c "if [ -f /etc/logrotate.conf ]; then /usr/bin/systemctl set-environment etc_conf=/etc/logrotate.conf; fi" ; \
|
||||||
|
/bin/sh -c "/usr/bin/systemctl set-environment usr_etc_conf=" ; \
|
||||||
|
/bin/sh -c "if [ -f /usr/etc/logrotate.conf ]; then /usr/bin/systemctl set-environment usr_etc_conf=/usr/etc/logrotate.conf; fi" ; \
|
||||||
|
/bin/sh -c "/usr/bin/systemctl set-environment usr_etc_dir=" ; \
|
||||||
|
/bin/sh -c "if [ -d /usr/etc/logrotate.d ]; then /usr/bin/systemctl set-environment usr_etc_dir=/usr/etc/logrotate.d; fi" ; \
|
||||||
/bin/sh -c "/usr/bin/systemctl set-environment etc_dir=" ; \
|
/bin/sh -c "/usr/bin/systemctl set-environment etc_dir=" ; \
|
||||||
/bin/sh -c "if [ -d /etc/logrotate.d ]; then /usr/bin/systemctl set-environment etc_dir=/etc/logrotate.d; fi"
|
/bin/sh -c "if [ -d /etc/logrotate.d ]; then /usr/bin/systemctl set-environment etc_dir=/etc/logrotate.d; fi"
|
||||||
ExecStart=/bin/sh -c "/usr/sbin/logrotate /usr/etc/logrotate.conf ${etc_conf} ${etc_dir}"
|
ExecStart=/bin/sh -c "/usr/sbin/logrotate ${usr_etc_conf} ${etc_conf} ${etc_dir} ${usr_etc_dir}"
|
||||||
|
|
||||||
# performance options
|
# performance options
|
||||||
Nice=19
|
Nice=19
|
||||||
|
@ -32,7 +32,7 @@ Source2: logrotate.default
|
|||||||
Source3: logrotate.service
|
Source3: logrotate.service
|
||||||
Source10: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc
|
Source10: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc
|
||||||
Source100: %{name}-rpmlintrc
|
Source100: %{name}-rpmlintrc
|
||||||
Patch0: logrotate-3.20.0-man_logrotate.patch
|
Patch0: logrotate-vendor-dir.patch
|
||||||
BuildRequires: acl
|
BuildRequires: acl
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: libacl-devel
|
BuildRequires: libacl-devel
|
||||||
@ -60,7 +60,8 @@ autoreconf -f -i
|
|||||||
%configure \
|
%configure \
|
||||||
--disable-silent-rules \
|
--disable-silent-rules \
|
||||||
--with-state-file-path=%{_localstatedir}/lib/misc/logrotate.status \
|
--with-state-file-path=%{_localstatedir}/lib/misc/logrotate.status \
|
||||||
--disable-werror
|
--disable-werror \
|
||||||
|
--enable-vendordir
|
||||||
%make_build
|
%make_build
|
||||||
|
|
||||||
%check
|
%check
|
||||||
|
Loading…
x
Reference in New Issue
Block a user