[oe-commits] [openembedded-core] 25/57: logrotate: Improve configurability of the installed systemd service files

git at git.openembedded.org git at git.openembedded.org
Thu Jul 26 12:17:47 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit ca3f2f6b49edee7052ef941228dc477d9060bdd9
Author: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
AuthorDate: Thu Jul 19 20:19:39 2018 +0200

    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"
    
    Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/recipes-extended/logrotate/logrotate_3.14.0.bb | 20 +++++++++++++++-----
 1 file 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 d48539f..ccc68ad 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"
 PACKAGECONFIG[selinux] = ",,libselinux"
 
 CONFFILES_${PN} += "${localstatedir}/lib/logrotate.status \
-		    ${sysconfdir}/logrotate.conf \
-		    ${sysconfdir}/logrotate.d/btmp \
-		    ${sysconfdir}/logrotate.d/wtmp"
+                    ${sysconfdir}/logrotate.conf \
+                    ${sysconfdir}/logrotate.d/btmp \
+                    ${sysconfdir}/logrotate.d/wtmp"
 
 # If RPM_OPT_FLAGS is unset, it adds -g itself rather than obeying our
 # optimization variables, so use it rather than EXTRA_CFLAGS.
@@ -62,8 +62,11 @@ SYSTEMD_SERVICE_${PN} = "\
     ${BPN}.timer \
 "
 
+LOGROTATE_OPTIONS ?= ""
+
 LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily"
 LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h"
+LOGROTATE_SYSTEMD_TIMER_PERSISTENT ?= "true"
 
 do_install(){
     oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir}
@@ -78,8 +81,15 @@ do_install(){
         install -d ${D}${systemd_system_unitdir}
         install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service
         install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer
-        sed -i -e 's,OnCalendar=.*$,OnCalendar=${LOGROTATE_SYSTEMD_TIMER_BASIS},g' ${D}${systemd_system_unitdir}/logrotate.timer
-        sed -i -e 's,AccuracySec=.*$,AccuracySec=${LOGROTATE_SYSTEMD_TIMER_ACCURACY},g' ${D}${systemd_system_unitdir}/logrotate.timer
+        [ -z "${LOGROTATE_OPTIONS}" ] ||
+            sed -ri \
+                -e 's|(ExecStart=.*/logrotate.*)$|\1 ${LOGROTATE_OPTIONS}|g' \
+                ${D}${systemd_system_unitdir}/logrotate.service
+        sed -ri \
+            -e 's|(OnCalendar=).*$|\1${LOGROTATE_SYSTEMD_TIMER_BASIS}|g' \
+            -e 's|(AccuracySec=).*$|\1${LOGROTATE_SYSTEMD_TIMER_ACCURACY}|g' \
+            -e 's|(Persistent=).*$|\1${LOGROTATE_SYSTEMD_TIMER_PERSISTENT}|g' \
+            ${D}${systemd_system_unitdir}/logrotate.timer
     fi
 
     if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list