<div dir="ltr">On 13 April 2017 at 08:42, Romain Perier <span dir="ltr"><<a href="mailto:romain.perier@collabora.com" target="_blank">romain.perier@collabora.com</a>></span> wrote:<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
--- /dev/null<br>
+++ b/meta/recipes-extended/<wbr>logrotate/logrotate/logrotate.<wbr>service<br>
@@ -0,0 +1,10 @@<br>
+[Unit]<br>
+Description=Rotate log files<br>
+ConditionACPower=true<br>
+<br>
+[Service]<br>
+Type=oneshot<br>
+ExecStart=/usr/sbin/logrotate /etc/logrotate.conf<br></blockquote><div><br></div><div>Hard-coding these paths breaks anyone who wants to change them, use symbols and replace them at build time.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+SYSTEMD_AUTO_ENABLE = "disable"<br></blockquote><div><br></div><div>What's the rationale for disabling logrotate by default? The cron script in the sysv case isn't disabled out of the box from what I can tell, so that's a behavioural change based on init.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+LOGROTATE_SYSTEMD_TIMER_BASIS ?= "daily"<br>
+LOGROTATE_SYSTEMD_TIMER_<wbr>ACCURACY ?= "12h"<br></blockquote><div><br></div><div>Do these really need to be variables in the recipe?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+ # Install systemd unit files<br>
+ if [ "${@bb.utils.contains('DISTRO_<wbr>FEATURES', 'systemd', 'systemd', '', d)}" = "systemd" ]; then<br>
+ install -d ${D}${systemd_system_unitdir}<br>
+ install -m 0644 ${WORKDIR}/logrotate.service ${D}${systemd_system_unitdir}/<wbr>logrotate.service<br>
+ install -m 0644 ${WORKDIR}/logrotate.timer ${D}${systemd_system_unitdir}/<wbr>logrotate.timer<br>
+ sed -i -e 's,OnCalendar=.*$,OnCalendar=$<wbr>{LOGROTATE_SYSTEMD_TIMER_<wbr>BASIS},g' ${D}${systemd_system_unitdir}/<wbr>logrotate.timer<br>
+ sed -i -e 's,AccuracySec=.*$,<wbr>AccuracySec=${LOGROTATE_<wbr>SYSTEMD_TIMER_ACCURACY},g' ${D}${systemd_system_unitdir}/<wbr>logrotate.timer<br>
+ else<br>
+ mkdir -p ${D}${sysconfdir}/cron.daily<br>
+ install -p -m 0755 examples/logrotate.cron ${D}${sysconfdir}/cron.daily/<wbr>logrotate<br>
+ fi<br></blockquote><div><br></div><div>This breaks if the DISTRO_FEATURES contains both sysvinit and systemd (so packages should contain the systemd and sysv integration), and different images are generated that use either sysvinit or systemd. With this the cron hooks won't be added but if the package is used under sysv they'll be needed.</div><div><br></div><div>Not that I have a good idea for how to solve this. Maybe the cron should check the timer unit isn't running?</div><div><br></div><div>Ross</div></div></div></div>