diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2018-07-19 20:19:39 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-26 13:16:40 +0100 |
commit | 866e437f21bfe491ae7dbcd9a7cbb0fd465b3669 (patch) | |
tree | 34e90d984b10014108f1460a8fdc1c98979c2f50 /meta | |
parent | b30285ca8fd049170bb13c3e80af4e8b2700427e (diff) | |
download | poky-866e437f21bfe491ae7dbcd9a7cbb0fd465b3669.tar.gz |
logrotate: Improve configurability of the installed systemd service files
This makes it possible to add extra options to the logrotate
application (via ${LOGROTATE_OPTIONS}), and it allows the Persistent
option in logrotate.timer to be configured via
${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}.
It also changes the sed expressions to allow for
${LOGROTATE_SYSTEMD_TIMER_BASIS} to contain commas without having to
prefix them with backslahes, e.g.:
LOGROTATE_SYSTEMD_TIMER_BASIS = "*-*-* *:00,30:00"
(From OE-Core rev: ca3f2f6b49edee7052ef941228dc477d9060bdd9)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-extended/logrotate/logrotate_3.14.0.bb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/meta/recipes-extended/logrotate/logrotate_3.14.0.bb b/meta/recipes-extended/logrotate/logrotate_3.14.0.bb index d48539f84f..ccc68ad3ac 100644 --- a/meta/recipes-extended/logrotate/logrotate_3.14.0.bb +++ b/meta/recipes-extended/logrotate/logrotate_3.14.0.bb | |||
@@ -34,9 +34,9 @@ PACKAGECONFIG[acl] = ",,acl" | |||
34 | PACKAGECONFIG[selinux] = ",,libselinux" | 34 | PACKAGECONFIG[selinux] = ",,libselinux" |
35 | 35 | ||
36 | CONFFILES_${PN} += "${localstatedir}/lib/logrotate.status \ | 36 | CONFFILES_${PN} += "${localstatedir}/lib/logrotate.status \ |
37 | ${sysconfdir}/logrotate.conf \ | 37 | ${sysconfdir}/logrotate.conf \ |
38 | ${sysconfdir}/logrotate.d/btmp \ | 38 | ${sysconfdir}/logrotate.d/btmp \ |
39 | ${sysconfdir}/logrotate.d/wtmp" | 39 | ${sysconfdir}/logrotate.d/wtmp" |
40 | 40 | ||
41 | # If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our | 41 | # If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our |
42 | # optimization variables, so use it rather than EXTRA_CFLAGS. | 42 | # optimization variables, so use it rather than EXTRA_CFLAGS. |
@@ -62,8 +62,11 @@ SYSTEMD_SERVICE_${PN} = "\ | |||
62 | ${BPN}.timer \ | 62 | ${BPN}.timer \ |
63 | " | 63 | " |
64 | 64 | ||
65 | LOGROTATE_OPTIONS ?= "" | ||
66 | |||
65 | LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily" | 67 | LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily" |
66 | LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h" | 68 | LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h" |
69 | LOGROTATE_SYSTEMD_TIMER_PERSISTENT ?= "true" | ||
67 | 70 | ||
68 | do_install(){ | 71 | do_install(){ |
69 | oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} | 72 | oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} |
@@ -78,8 +81,15 @@ do_install(){ | |||
78 | install -d ${D}${systemd_system_unitdir} | 81 | install -d ${D}${systemd_system_unitdir} |
79 | install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service | 82 | install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service |
80 | install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer | 83 | install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer |
81 | sed -i -e 's,OnCalendar=.*$,OnCalendar=${LOGROTATE_SYSTEMD_TIMER_BASIS},g' ${D}${systemd_system_unitdir}/logrotate.timer | 84 | [ -z "${LOGROTATE_OPTIONS}" ] || |
82 | sed -i -e 's,AccuracySec=.*$,AccuracySec=${LOGROTATE_SYSTEMD_TIMER_ACCURACY},g' ${D}${systemd_system_unitdir}/logrotate.timer | 85 | sed -ri \ |
86 | -e 's|(ExecStart=.*/logrotate.*)$|\1 ${LOGROTATE_OPTIONS}|g' \ | ||
87 | ${D}${systemd_system_unitdir}/logrotate.service | ||
88 | sed -ri \ | ||
89 | -e 's|(OnCalendar=).*$|\1${LOGROTATE_SYSTEMD_TIMER_BASIS}|g' \ | ||
90 | -e 's|(AccuracySec=).*$|\1${LOGROTATE_SYSTEMD_TIMER_ACCURACY}|g' \ | ||
91 | -e 's|(Persistent=).*$|\1${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}|g' \ | ||
92 | ${D}${systemd_system_unitdir}/logrotate.timer | ||
83 | fi | 93 | fi |
84 | 94 | ||
85 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | 95 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |