Currently, both sys-apps/mlocate and sys-apps/man-db ship with a cron script that goes to cron.daily, and only works as intended on systems with a cron daemon. But, as systemd already incorporates support for cron-like functionality with timers, I would suggest adding a timer unit and a service files for these two packages respectively, by shipping and activating them (either statically by making a symlink to a defined target through a post-install step or by invoking systemctl enable) with a timers flag or any other USE flag that could provide similar functionality.
This way, systems with systemd and without cron would still be able to keep there mlocate and man databases up to date.
Arch Linux already does this, and for now, I've imported their scripts and added an [Install] section to their timers to enable it, rather than making a symlink.
I'm thus adding links for those two packages from the Arch git repositories, and leaving everything else up to the developers to discuss and decide.
Steps to Reproduce:
> by shipping and activating them
I'm not sure about activating things by default. I don't even think it makes sense to enable the cron jobs by default, but that's a historical remnant.
I'm thinking we could put a pkg_postinst message behind 'systemd_is_booted' if we are really concerned about making the user aware of them. For example:
if systemd_is_booted; then
elog "systemd timer unit X.timer has been installed."
elog "Activate it with 'systemd enable X.timer'"
That is fine too.
*** Bug 642150 has been marked as a duplicate of this bug. ***
*** Bug 642152 has been marked as a duplicate of this bug. ***
man-db-2.8.5 installs a systemd timer unit.
More inspiration for the timer/service files is provided by the Fedora package:
The bug has been closed via the following commit(s):
Author: Mike Gilbert <email@example.com>
AuthorDate: 2020-04-12 16:06:19 +0000
Commit: Mike Gilbert <firstname.lastname@example.org>
CommitDate: 2020-04-12 16:17:13 +0000
sys-apps/mlocate: modernize ebuild
- Depend on acct-group/locate
- Install systemd service/timer
- Remove unneeded fperms/chown
- Display postinst message on initial install only
Package-Manager: Portage-2.3.96_p4, Repoman-2.3.22_p1
Signed-off-by: Mike Gilbert <email@example.com>
sys-apps/mlocate/files/updatedb.service | 7 ++++
sys-apps/mlocate/files/updatedb.timer | 10 ++++++
sys-apps/mlocate/mlocate-0.26-r3.ebuild | 63 +++++++++++++++++++++++++++++++++
3 files changed, 80 insertions(+)