summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/logrotate
diff options
context:
space:
mode:
authorRomain Perier <romain.perier@collabora.com>2017-07-11 08:46:06 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-21 22:51:37 +0100
commit97c3a88082e5e5ede20c2ed8657c3b53ef5335e7 (patch)
treeef7c5e5dbb36022650f6c94100c10c70dd487c7a /meta/recipes-extended/logrotate
parent98d3a094d0d474303c3096d4c5d6223b7d5d7c3d (diff)
downloadpoky-97c3a88082e5e5ede20c2ed8657c3b53ef5335e7.tar.gz
logrotate: Add systemd support
Currently, this recipe only supports daily scheduling via a cron job. This commit adds support for systemd in the recipe, as the feature is already supported on upstream. When the corresponding distro feature is enabled the systemd variant will be used. The timer granularity and its accuracy are also configurable. (From OE-Core rev: b942d0b17cb6622b653283109307346dcfb4f205) Signed-off-by: Romain Perier <romain.perier@collabora.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/logrotate')
-rw-r--r--meta/recipes-extended/logrotate/logrotate_3.12.3.bb25
1 files changed, 22 insertions, 3 deletions
diff --git a/meta/recipes-extended/logrotate/logrotate_3.12.3.bb b/meta/recipes-extended/logrotate/logrotate_3.12.3.bb
index 2033be1e2d..05705bedbe 100644
--- a/meta/recipes-extended/logrotate/logrotate_3.12.3.bb
+++ b/meta/recipes-extended/logrotate/logrotate_3.12.3.bb
@@ -53,14 +53,33 @@ EXTRA_OEMAKE = "\
53# INSTALL=install and BASEDIR=/usr. 53# INSTALL=install and BASEDIR=/usr.
54OS_NAME = "Linux" 54OS_NAME = "Linux"
55 55
56inherit autotools 56inherit autotools systemd
57
58SYSTEMD_SERVICE_${PN} = "\
59 ${PN}.service \
60 ${PN}.timer \
61"
62
63LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily"
64LOGROTATE_SYSTEMD_TIMER_ACCURACY ?= "12h"
57 65
58do_install(){ 66do_install(){
59 oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir} 67 oe_runmake install DESTDIR=${D} PREFIX=${D} MANDIR=${mandir}
60 mkdir -p ${D}${sysconfdir}/logrotate.d 68 mkdir -p ${D}${sysconfdir}/logrotate.d
61 mkdir -p ${D}${sysconfdir}/cron.daily
62 mkdir -p ${D}${localstatedir}/lib 69 mkdir -p ${D}${localstatedir}/lib
63 install -p -m 644 ${S}/examples/logrotate-default ${D}${sysconfdir}/logrotate.conf 70 install -p -m 644 ${S}/examples/logrotate-default ${D}${sysconfdir}/logrotate.conf
64 install -p -m 755 ${S}/examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate
65 touch ${D}${localstatedir}/lib/logrotate.status 71 touch ${D}${localstatedir}/lib/logrotate.status
72
73 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
74 install -d ${D}${systemd_system_unitdir}
75 install -m 0644 ${S}/examples/logrotate.service ${D}${systemd_system_unitdir}/logrotate.service
76 install -m 0644 ${S}/examples/logrotate.timer ${D}${systemd_system_unitdir}/logrotate.timer
77 sed -i -e 's,OnCalendar=.*$,OnCalendar=${LOGROTATE_SYSTEMD_TIMER_BASIS},g' ${D}${systemd_system_unitdir}/logrotate.timer
78 sed -i -e 's,AccuracySec=.*$,AccuracySec=${LOGROTATE_SYSTEMD_TIMER_ACCURACY},g' ${D}${systemd_system_unitdir}/logrotate.timer
79 fi
80
81 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
82 mkdir -p ${D}${sysconfdir}/cron.daily
83 install -p -m 0755 ${S}/examples/logrotate.cron ${D}${sysconfdir}/cron.daily/logrotate
84 fi
66} 85}