Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508524 - app-admin/denyhosts - provide logrotate.d entry that works with systemd
Summary: app-admin/denyhosts - provide logrotate.d entry that works with systemd
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Pavlos Ratis (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-23 14:26 UTC by Sławomir Nizio
Modified: 2014-05-16 17:30 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sławomir Nizio 2014-04-23 14:26:40 UTC
This package installs systemd file, yet its logrotate file assumes OpenRC.

Reproducible: Always
Comment 1 Christoph Junghans (RETIRED) gentoo-dev 2014-04-29 15:32:30 UTC
Some more details on what to fix would be nice!
Comment 2 Mike Gilbert gentoo-dev 2014-04-29 19:32:10 UTC
The logrotate file calls the openrc init script /etc/init.d/denyhosts stop/start in prerotate and postrotate hooks.

This will not work with systemd.

One possible solution: Create a shell script to detect if the system is booted via systemd or openrc, and invoke the appropriate init system. It's pretty ugly, but it could work.

As a general comment, stopping/starting the service is a rather ugly method for doing this. Does the daemon not offer some way to do this more cleanly?
Comment 3 Sławomir Nizio 2014-04-29 21:07:07 UTC
There could be at least two ways which I have seen.

a) like in app-admin/syslog-ng

  if use systemd ; then
    sed \
      's/@GENTOO_RESTART@/systemctl kill -s HUP syslog-ng/' \
      $f > ${f/.in/} || die
  else
    sed \
      's:@GENTOO_RESTART@:/etc/init.d/syslog-ng reload:' \
      $f > ${f/.in/} || die
  fi

b) like in net-analyzer/munin (logrotate.d-munin.3)

test -e /run/openrc/softlevel && /etc/init.d/munin-node restart 1>/dev/null || true
test -e /run/systemd/system && systemctl restart munin-node 1>/dev/null || true
Comment 4 Sławomir Nizio 2014-04-29 21:08:59 UTC
(In reply to Christoph Junghans from comment #1)
> Some more details on what to fix would be nice!

if you insist :)
Comment 5 Mike Gilbert gentoo-dev 2014-04-29 21:32:37 UTC
(In reply to SN (Enlik) from comment #3)

That syslog-ng example is rather bad. I'm tempted to go fix that.
Comment 6 Pacho Ramos gentoo-dev 2014-04-30 06:20:54 UTC
I also prefer "munin's way"
Comment 7 Christoph Junghans (RETIRED) gentoo-dev 2014-04-30 15:22:06 UTC
(In reply to Pacho Ramos from comment #6)
> I also prefer "munin's way"
Agreed, Enlik can you create a patch for us?
Comment 8 Sławomir Nizio 2014-04-30 19:35:30 UTC
I don't even use it - just wanted to have it sorted for Sabayon, but I can try to come up with something within a few days.

With something that hopefully addresses Mike's comment:

"As a general comment, stopping/starting the service is a rather ugly method for doing this. Does the daemon not offer some way to do this more cleanly?"
Comment 9 Christoph Junghans (RETIRED) gentoo-dev 2014-05-14 23:22:44 UTC
+*denyhosts-2.6-r10 (14 May 2014)
+
+  14 May 2014; Christoph Junghans <ottxor@gentoo.org> +denyhosts-2.6-r10.ebuild,
+  +files/denyhosts.logrotate-r2:
+  provide logrotate.d entry that works with systemd (bug #508524)
+
Comment 10 Sławomir Nizio 2014-05-16 17:30:53 UTC
I was really going to! Sorry for the delay and thanks for this.