forked from pool/logrotate
- Remove all patches merged upstream:
* logrotate-addextension.patch * logrotate-autoext.patch * logrotate-conf.patch * logrotate-fix-test62_with_bash-4.4.patch * logrotate-manpage_config_clarification.patch * logrotate-var-lib-misc.patch * logrotate-3.7.8-suse.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=57
This commit is contained in:
parent
3cacfc6449
commit
aa3e4cc2dd
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:15a5d4db53cec8f8e0561e88a0d8ee737a45dee1aba280c6e75f92950ca9306c
|
||||
size 127492
|
3
logrotate-3.11.0.tar.xz
Normal file
3
logrotate-3.11.0.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:18ae0f2ec1f14d9550c9f6bd9a2b6a18440e6a0fd7d5923a6e3fcb7d45946261
|
||||
size 132132
|
@ -1,32 +0,0 @@
|
||||
Index: examples/logrotate.cron
|
||||
===================================================================
|
||||
--- examples/logrotate.cron.orig
|
||||
+++ examples/logrotate.cron
|
||||
@@ -1,8 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
-/usr/sbin/logrotate /etc/logrotate.conf
|
||||
-EXITVALUE=$?
|
||||
-if [ $EXITVALUE != 0 ]; then
|
||||
- /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
|
||||
+# exit immediately if there is another instance running
|
||||
+if checkproc /usr/sbin/logrotate; then
|
||||
+ /bin/logger -p cron.warning -t logrotate "ALERT another instance of logrotate is running - exiting"
|
||||
+ exit 1
|
||||
fi
|
||||
+
|
||||
+TMPF=`mktemp /tmp/logrotate.XXXXXXXXXX`
|
||||
+
|
||||
+/usr/sbin/logrotate /etc/logrotate.conf 2>&1 | tee $TMPF
|
||||
+EXITVALUE=${PIPESTATUS[0]}
|
||||
+
|
||||
+if [ $EXITVALUE != 0 ]; then
|
||||
+ # wait a sec, we might just have restarted syslog
|
||||
+ sleep 1
|
||||
+ # tell what went wrong
|
||||
+ /bin/logger -p cron.warning -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
|
||||
+ /bin/logger -p cron.warning -t logrotate -f $TMPF
|
||||
+ fi
|
||||
+
|
||||
+rm -f $TMPF
|
||||
exit 0
|
@ -1,150 +0,0 @@
|
||||
Index: test/test
|
||||
===================================================================
|
||||
--- test/test.orig
|
||||
+++ test/test
|
||||
@@ -1746,5 +1746,28 @@ EOF
|
||||
rm -rf testdir adir
|
||||
rm -rf testdir bdir
|
||||
|
||||
+# check rotation with extension appended to the filename
|
||||
+cleanup 100
|
||||
+
|
||||
+preptest test.log 100 1 0
|
||||
+$RLR test-config.100 --force
|
||||
+
|
||||
+checkoutput <<EOF
|
||||
+test.log 0
|
||||
+test.log.1.newext 0 zero
|
||||
+EOF
|
||||
+
|
||||
+# check rotation with extension moved after the number
|
||||
+cleanup 101
|
||||
+
|
||||
+preptest test.log 101 1 0
|
||||
+$RLR test-config.101 --force
|
||||
+
|
||||
+checkoutput <<EOF
|
||||
+test.log 0
|
||||
+test.1.log 0 zero
|
||||
+EOF
|
||||
+
|
||||
+
|
||||
cleanup
|
||||
|
||||
Index: config.c
|
||||
===================================================================
|
||||
--- config.c.orig
|
||||
+++ config.c
|
||||
@@ -637,6 +637,7 @@ int readAllConfigPaths(const char **path
|
||||
.preremove = NULL,
|
||||
.logAddress = NULL,
|
||||
.extension = NULL,
|
||||
+ .addextension = NULL,
|
||||
.compress_prog = NULL,
|
||||
.uncompress_prog = NULL,
|
||||
.compress_ext = NULL,
|
||||
@@ -1224,6 +1225,19 @@ static int readConfigFile(const char *co
|
||||
message(MESS_DEBUG, "extension is now %s\n",
|
||||
newlog->extension);
|
||||
|
||||
+ } else if (!strcmp(key, "addextension")) {
|
||||
+ if ((key = isolateValue
|
||||
+ (configFile, lineNum, "addextension name", &start,
|
||||
+ &buf, length)) != NULL) {
|
||||
+ freeLogItem (addextension);
|
||||
+ newlog->addextension = key;
|
||||
+ key = NULL;
|
||||
+ }
|
||||
+ else continue;
|
||||
+
|
||||
+ message(MESS_DEBUG, "addextension is now %s\n",
|
||||
+ newlog->addextension);
|
||||
+
|
||||
} else if (!strcmp(key, "compresscmd")) {
|
||||
freeLogItem (compress_prog);
|
||||
|
||||
Index: logrotate.8
|
||||
===================================================================
|
||||
--- logrotate.8.orig
|
||||
+++ logrotate.8
|
||||
@@ -284,6 +284,15 @@ configured to be run by cron daily. You
|
||||
and run \fIlogrotate\fR hourly to be able to really rotate logs hourly.
|
||||
|
||||
.TP
|
||||
+\fBaddextension \fIext\fR
|
||||
+Log files are given the final extension \fIext\fR after rotation. If
|
||||
+the original file already ends with \fIext\fR, the extension is not
|
||||
+duplicated, but merely moved to the end, i.e. both \fBfilename\fR and
|
||||
+\fBfilename\fIext\fR would get rotated to filename.1\fIext\fR. If
|
||||
+compression is used, the compression extension (normally \fB.gz\fR)
|
||||
+appears after \fIext\fR.
|
||||
+
|
||||
+.TP
|
||||
\fBifempty\fR
|
||||
Rotate the log file even if it is empty, overriding the \fBnotifempty\fR
|
||||
option (\fBifempty\fR is the default).
|
||||
Index: logrotate.c
|
||||
===================================================================
|
||||
--- logrotate.c.orig
|
||||
+++ logrotate.c
|
||||
@@ -1219,6 +1219,24 @@ int prerotateSingleLog(struct logInfo *l
|
||||
|
||||
rotNames->baseName = strdup(ourBaseName(log->files[logNum]));
|
||||
|
||||
+ if (log->addextension) {
|
||||
+ size_t baseLen = strlen(rotNames->baseName);
|
||||
+ size_t extLen = strlen(log->addextension);
|
||||
+ if (baseLen >= extLen &&
|
||||
+ strncmp(&(rotNames->baseName[baseLen - extLen]),
|
||||
+ log->addextension, extLen) == 0) {
|
||||
+ char *tempstr;
|
||||
+
|
||||
+ fileext = log->addextension;
|
||||
+ tempstr = calloc(baseLen - extLen + 1, sizeof(char));
|
||||
+ strncat(tempstr, rotNames->baseName, baseLen - extLen);
|
||||
+ free(rotNames->baseName);
|
||||
+ rotNames->baseName = tempstr;
|
||||
+ } else {
|
||||
+ fileext = log->addextension;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (log->extension &&
|
||||
strncmp(&
|
||||
(rotNames->
|
||||
Index: logrotate.h
|
||||
===================================================================
|
||||
--- logrotate.h.orig
|
||||
+++ logrotate.h
|
||||
@@ -54,6 +54,7 @@ struct logInfo {
|
||||
char *pre, *post, *first, *last, *preremove;
|
||||
char *logAddress;
|
||||
char *extension;
|
||||
+ char *addextension;
|
||||
char *compress_prog;
|
||||
char *uncompress_prog;
|
||||
char *compress_ext;
|
||||
Index: test/test-config.100.in
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ test/test-config.100.in
|
||||
@@ -0,0 +1,7 @@
|
||||
+create
|
||||
+
|
||||
+&DIR&/test.log {
|
||||
+ monthly
|
||||
+ rotate 1
|
||||
+ addextension .newext
|
||||
+}
|
||||
Index: test/test-config.101.in
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ test/test-config.101.in
|
||||
@@ -0,0 +1,7 @@
|
||||
+create
|
||||
+
|
||||
+&DIR&/test.log {
|
||||
+ monthly
|
||||
+ rotate 1
|
||||
+ addextension .log
|
||||
+}
|
@ -1,105 +0,0 @@
|
||||
Index: config.c
|
||||
===================================================================
|
||||
--- config.c.orig
|
||||
+++ config.c
|
||||
@@ -716,6 +716,7 @@ static int readConfigFile(const char *co
|
||||
char **scriptDest = NULL;
|
||||
struct logInfo *newlog = defConfig;
|
||||
char *start, *chptr;
|
||||
+ char *compresscmd_base;
|
||||
char *dirName;
|
||||
struct passwd *pw = NULL;
|
||||
int rc;
|
||||
@@ -1242,6 +1243,20 @@ static int readConfigFile(const char *co
|
||||
message(MESS_DEBUG, "compress_prog is now %s\n",
|
||||
newlog->compress_prog);
|
||||
|
||||
+ compresscmd_base=strdup(basename(newlog->compress_prog));
|
||||
+ fprintf(stdout, "compress_ext is %s\n", newlog->compress_prog);
|
||||
+ i=0; /* have to check whether we may do this! */
|
||||
+ /* we check whether we changed the compress_cmd. In case we use the apropriate extension
|
||||
+ as listed in compress_cmd_list */
|
||||
+ while ((i>=0)&&(strcmp(compress_cmd_list[i][0], "EOLIST"))){
|
||||
+ if (0==strcmp(compress_cmd_list[i][0], compresscmd_base)){
|
||||
+ newlog->compress_ext=strdup((char *)compress_cmd_list[i][1]);
|
||||
+ message(MESS_DEBUG, "compress_ext was changed to %s\n", newlog->compress_ext);
|
||||
+ fprintf(stdout, "compress_ext was changed to %s\n", newlog->compress_ext);
|
||||
+ i=-10; /* terminate loop! */
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
} else if (!strcmp(key, "uncompresscmd")) {
|
||||
freeLogItem (uncompress_prog);
|
||||
|
||||
Index: logrotate.c
|
||||
===================================================================
|
||||
--- logrotate.c.orig
|
||||
+++ logrotate.c
|
||||
@@ -104,6 +104,16 @@ unsigned int hashSize;
|
||||
int numLogs = 0;
|
||||
int debug = 0;
|
||||
char *mailCommand = DEFAULT_MAIL_COMMAND;
|
||||
+/* This is the declaration. Note the "2" is needed in the definition (logrotate.h), too! */
|
||||
+const char * compress_cmd_list[][2] = {
|
||||
+ {"gzip", ".gz"},
|
||||
+ {"bzip2", ".bz2"},
|
||||
+ {"xz", ".xz"},
|
||||
+ {"compress", ".Z"},
|
||||
+ {"zip", "zip"},
|
||||
+ {"EOLIST", "EOLIST"} /* end-marker */
|
||||
+};
|
||||
+
|
||||
time_t nowSecs = 0;
|
||||
static uid_t save_euid;
|
||||
static gid_t save_egid;
|
||||
Index: logrotate.h
|
||||
===================================================================
|
||||
--- logrotate.h.orig
|
||||
+++ logrotate.h
|
||||
@@ -79,6 +79,9 @@ TAILQ_HEAD(logInfoHead, logInfo) logs;
|
||||
extern int numLogs;
|
||||
extern int debug;
|
||||
|
||||
+/* This is the definition. Note we have to carry the "2" within the declaration (logrotate.c), too! */
|
||||
+extern const char * compress_cmd_list[][2];
|
||||
+
|
||||
int readAllConfigPaths(const char **paths);
|
||||
#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
|
||||
int asprintf(char **string_ptr, const char *format, ...);
|
||||
Index: test/test
|
||||
===================================================================
|
||||
--- test/test.orig
|
||||
+++ test/test
|
||||
@@ -577,32 +577,6 @@ checkoutput <<EOF
|
||||
test.log 0 zero
|
||||
EOF
|
||||
|
||||
-cleanup 18
|
||||
-
|
||||
-# ------------------------------- Test 18 ------------------------------------
|
||||
-preptest test.log 18 1
|
||||
-$RLR test-config.18 -l syslog --force
|
||||
-
|
||||
-checkoutput <<EOF
|
||||
-test.log 0
|
||||
-test.log.1.gz 1 zero
|
||||
-EOF
|
||||
-
|
||||
-(echo "gzip -f -9") | diff -u - compress-args
|
||||
-egrep -q '^LOGROTATE_COMPRESSED_FILENAME=.+/test/test.log.1$' compress-env
|
||||
-if [ $? != 0 ]; then
|
||||
- echo "LOGROTATE_COMPRESSED_FILENAME environment variable not found."
|
||||
- cat compress-env++ exit 3
|
||||
-fi
|
||||
-
|
||||
-if [ $SYSLOG_TESTS = 1 ]; then
|
||||
- journalctl -n 50 2>/dev/null|grep $PWD/test.log.1 2>/dev/null >/dev/null
|
||||
- if [ $? != 0 ]; then
|
||||
- echo "syslog message not found"
|
||||
- exit 1
|
||||
- fi
|
||||
-fi
|
||||
-
|
||||
cleanup 19
|
||||
|
||||
# ------------------------------- Test 19 ------------------------------------
|
@ -1,51 +0,0 @@
|
||||
Index: examples/logrotate-default
|
||||
===================================================================
|
||||
--- examples/logrotate-default.orig
|
||||
+++ examples/logrotate-default
|
||||
@@ -14,22 +14,13 @@
|
||||
# uncomment this if you want your log files compressed
|
||||
#compress
|
||||
|
||||
-# RPM packages drop log rotation information into this directory
|
||||
-include /etc/logrotate.d
|
||||
-
|
||||
-# no packages own wtmp and btmp -- we'll rotate them here
|
||||
-/var/log/wtmp {
|
||||
- monthly
|
||||
- create 0664 root utmp
|
||||
- minsize 1M
|
||||
- rotate 1
|
||||
-}
|
||||
+# comment these to switch compression to use gzip or another
|
||||
+# compression scheme
|
||||
+compresscmd /usr/bin/xz
|
||||
+uncompresscmd /usr/bin/xzdec
|
||||
|
||||
-/var/log/btmp {
|
||||
- missingok
|
||||
- monthly
|
||||
- create 0600 root utmp
|
||||
- rotate 1
|
||||
-}
|
||||
+# former versions had to have the compressext set accordingly
|
||||
+#compressext .xz
|
||||
|
||||
-# system-specific logs may be also be configured here.
|
||||
+# RPM packages drop log rotation information into this directory
|
||||
+include /etc/logrotate.d
|
||||
Index: examples/logrotate.wtmp
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ examples/logrotate.wtmp
|
||||
@@ -0,0 +1,11 @@
|
||||
+/var/log/wtmp /var/log/btmp {
|
||||
+ compress
|
||||
+ dateext
|
||||
+ maxage 365
|
||||
+ rotate 99
|
||||
+ size=+400k
|
||||
+ notifempty
|
||||
+ missingok
|
||||
+ copytruncate
|
||||
+}
|
||||
+
|
@ -1,29 +0,0 @@
|
||||
From 61f22b1eb2bd441bce998240701b0acd03265a47 Mon Sep 17 00:00:00 2001
|
||||
From: Dominique Leuenberger <dimstar@opensuse.org>
|
||||
Date: Mon, 3 Oct 2016 16:43:00 +0200
|
||||
Subject: [PATCH] Fix test suite in combination with bash 4.4
|
||||
|
||||
Until bash 4.4, variables were silently stripped of NUL bytes; with Bash 4.4
|
||||
this results now for every single 0-byte that is being stripped in a warning:
|
||||
|
||||
./test: line 170: warning: command substitution: ignored null byte in input
|
||||
|
||||
We now simply strip the NUL bytes before we have bash assign the values to
|
||||
a variable. The result is the same.
|
||||
---
|
||||
test/test | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: logrotate-3.10.0/test/test
|
||||
===================================================================
|
||||
--- logrotate-3.10.0.orig/test/test
|
||||
+++ logrotate-3.10.0/test/test
|
||||
@@ -183,7 +183,7 @@ checkoutput() {
|
||||
if [ -n "$co_compressed" ] && [ "$co_compressed" != 0 ]; then
|
||||
contents=`gunzip -c $file`
|
||||
else
|
||||
- contents=`cat $file`
|
||||
+ contents=`cat $file | tr -d '\000'`
|
||||
fi
|
||||
if [ "$contents" != "$expected" ]; then
|
||||
echo "file $file does not contain expected results (compressed $co_compressed, args $*)" >&2
|
@ -1,15 +0,0 @@
|
||||
Index: logrotate-3.8.5/logrotate.8
|
||||
===================================================================
|
||||
--- logrotate-3.8.5.orig/logrotate.8 2013-07-25 15:30:36.687434418 +0200
|
||||
+++ logrotate-3.8.5/logrotate.8 2013-07-31 16:08:57.460078472 +0200
|
||||
@@ -121,6 +121,10 @@
|
||||
anywhere in the config file as long as the first non-whitespace
|
||||
character on the line is a \fB#\fR.
|
||||
|
||||
+Values are separated from directives by whitespace and/or an optional =.
|
||||
+Numbers must be specified in a format understood by
|
||||
+.BR strtoul(3).
|
||||
+
|
||||
The next section of the config file defines how to handle the log file
|
||||
\fI/var/log/messages\fR. The log will go through five weekly rotations before
|
||||
being removed. After the log file has been rotated (but before the old
|
@ -1,20 +0,0 @@
|
||||
--- config.h
|
||||
+++ config.h 2016/11/12 21:04:31
|
||||
@@ -43,5 +43,5 @@
|
||||
#endif
|
||||
|
||||
#ifndef STATEFILE
|
||||
-#define STATEFILE "/var/lib/logrotate.status"
|
||||
+#define STATEFILE "/var/lib/misc/logrotate.status"
|
||||
#endif
|
||||
--- logrotate.8
|
||||
+++ logrotate.8 2016/11/12 21:00:05
|
||||
@@ -65,7 +65,7 @@
|
||||
\fB\-s\fR, \fB\-\-state <statefile>\fR
|
||||
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.
|
||||
+log files. The default state file is \fI/var/lib/misc/logrotate.status\fR.
|
||||
|
||||
.TP
|
||||
\fB\-\-usage\fR
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 28 11:19:13 UTC 2016 - tchvatal@suse.com
|
||||
|
||||
- Remove all patches merged upstream:
|
||||
* logrotate-addextension.patch
|
||||
* logrotate-autoext.patch
|
||||
* logrotate-conf.patch
|
||||
* logrotate-fix-test62_with_bash-4.4.patch
|
||||
* logrotate-manpage_config_clarification.patch
|
||||
* logrotate-var-lib-misc.patch
|
||||
* logrotate-3.7.8-suse.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 21 12:03:14 UTC 2016 - tchvatal@suse.com
|
||||
|
||||
|
23
logrotate.default
Normal file
23
logrotate.default
Normal file
@ -0,0 +1,23 @@
|
||||
# see "man logrotate" for details
|
||||
# rotate log files weekly
|
||||
weekly
|
||||
|
||||
# keep 4 weeks worth of backlogs
|
||||
rotate 4
|
||||
|
||||
# create new (empty) log files after rotating old ones
|
||||
create
|
||||
|
||||
# use date as a suffix of the rotated file
|
||||
dateext
|
||||
|
||||
# uncomment this if you want your log files compressed
|
||||
compress
|
||||
|
||||
# comment these to switch compression to use gzip or another
|
||||
# compression scheme
|
||||
compresscmd /usr/bin/xz
|
||||
uncompresscmd /usr/bin/xzdec
|
||||
|
||||
# RPM packages drop log rotation information into this directory
|
||||
include /etc/logrotate.d
|
@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=Rotate log files
|
||||
Documentation=man:logrotate(8) man:logrotate.conf(5)
|
||||
ConditionACPower=true
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf
|
||||
Nice=19
|
||||
IOSchedulingClass=best-effort
|
||||
IOSchedulingPriority=7
|
@ -17,33 +17,22 @@
|
||||
|
||||
|
||||
Name: logrotate
|
||||
Version: 3.10.0
|
||||
Version: 3.11.0
|
||||
Release: 0
|
||||
Summary: Rotate, compress, remove, and mail system log files
|
||||
License: GPL-2.0+
|
||||
Group: System/Base
|
||||
Url: https://github.com/logrotate/logrotate
|
||||
Source0: https://github.com/logrotate/logrotate/releases/download/%{version}/logrotate-%{version}.tar.xz
|
||||
# SUSE specific logrotate configurations
|
||||
Source1: logrotate.wtmp
|
||||
Source2: logrotate.default
|
||||
Source100: %{name}-rpmlintrc
|
||||
Source101: %{name}.service
|
||||
Source102: %{name}.timer
|
||||
Patch0: logrotate-3.7.8-suse.patch
|
||||
Patch1: logrotate-conf.patch
|
||||
Patch2: logrotate-autoext.patch
|
||||
Patch3: logrotate-addextension.patch
|
||||
Patch5: logrotate-manpage_config_clarification.patch
|
||||
# PATCH-FIX-UPSTREAM logrotate-fix-test62_with_bash-4.4.patch gh#logrotate/logrotate#66 dimstar@opensuse.org -- Fix test suite in combination with bash 4.4
|
||||
Patch6: logrotate-fix-test62_with_bash-4.4.patch
|
||||
# PATCH-FEATURE-SLE logrotate-var-lib-misc.patch FATE#322036:
|
||||
# According to FHS/LSB, this should be in /var/lib/misc. Which
|
||||
# would allow a read-only root filesystem without breaking snapshots,
|
||||
# rollback and transactional updates
|
||||
Patch7: logrotate-var-lib-misc.patch
|
||||
BuildRequires: acl
|
||||
BuildRequires: libacl-devel
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: popt-devel
|
||||
BuildRequires: pkgconfig(libselinux)
|
||||
BuildRequires: pkgconfig(popt)
|
||||
BuildRequires: pkgconfig(systemd) >= 197
|
||||
Requires: xz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -59,16 +48,10 @@ daily cron job.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0
|
||||
%patch1
|
||||
%patch2
|
||||
%patch3
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p0
|
||||
|
||||
%build
|
||||
%configure
|
||||
%configure \
|
||||
--with-state-file-path=%{_localstatedir}/lib/misc/logrotate.status
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%check
|
||||
@ -77,10 +60,10 @@ make %{?_smp_mflags} check
|
||||
%install
|
||||
%make_install
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
|
||||
install -m 644 examples/logrotate-default %{buildroot}%{_sysconfdir}/logrotate.conf
|
||||
install -m 644 examples/logrotate.wtmp %{buildroot}%{_sysconfdir}/logrotate.d/wtmp
|
||||
install -D -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}/%{name}.service
|
||||
install -D -m 0644 %{SOURCE102} %{buildroot}%{_unitdir}/%{name}.timer
|
||||
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/wtmp
|
||||
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.conf
|
||||
install -D -m 0644 examples/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
|
||||
install -D -m 0644 examples/%{name}.timer %{buildroot}%{_unitdir}/%{name}.timer
|
||||
ln -s service %{buildroot}%{_sbindir}/rc%{name}
|
||||
|
||||
%pre
|
||||
@ -94,8 +77,8 @@ if [ -f %{_sysconfdir}/logrotate.d/aaa_base ] ; then
|
||||
mv -v %{_sysconfdir}/logrotate.d/aaa_base %{_sysconfdir}/logrotate.d.aaa_base.save
|
||||
fi
|
||||
# Move /var/lib/logrotate.status
|
||||
if [ -f /var/lib/logrotate.status -a ! -f /var/lib/misc/logrotate.status ]; then
|
||||
mv /var/lib/logrotate.status /var/lib/misc/logrotate.status ||:
|
||||
if [ -f %{_localstatedir}/lib/logrotate.status -a ! -f %{_localstatedir}/lib/misc/logrotate.status ]; then
|
||||
mv %{_localstatedir}/lib/logrotate.status %{_localstatedir}/lib/misc/logrotate.status ||:
|
||||
fi
|
||||
|
||||
%service_add_post %{name}.service %{name}.timer
|
||||
@ -108,13 +91,13 @@ fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc CHANGES COPYING
|
||||
%doc COPYING ChangeLog.md README.md
|
||||
%{_sbindir}/logrotate
|
||||
%{_sbindir}/rc%{name}
|
||||
%{_mandir}/man8/logrotate.8*
|
||||
%{_mandir}/man5/logrotate.conf.5*
|
||||
%config %{_sysconfdir}/logrotate.conf
|
||||
%config(noreplace)%{_sysconfdir}/logrotate.d/wtmp
|
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/wtmp
|
||||
%{_unitdir}/%{name}.service
|
||||
%{_unitdir}/%{name}.timer
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=Daily rotation of log files
|
||||
Documentation=man:logrotate(8) man:logrotate.conf(5)
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
AccuracySec=12h
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
10
logrotate.wtmp
Normal file
10
logrotate.wtmp
Normal file
@ -0,0 +1,10 @@
|
||||
/var/log/wtmp /var/log/btmp {
|
||||
compress
|
||||
dateext
|
||||
maxage 365
|
||||
rotate 99
|
||||
size=+400k
|
||||
notifempty
|
||||
missingok
|
||||
copytruncate
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user