Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 622236 - sys-apps/mlocate - install systemd timer unit
Summary: sys-apps/mlocate - install systemd timer unit
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement with 1 vote (vote)
Assignee: Gentoo's Team for Core System packages
: 642150 642152 (view as bug list)
Depends on:
Reported: 2017-06-19 17:57 UTC by IntROOTER
Modified: 2020-04-12 16:17 UTC (History)
6 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description IntROOTER 2017-06-19 17:57:26 UTC
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.

Reproducible: Always

Steps to Reproduce:
Actual Results:  

Expected Results:  
Comment 1 Mike Gilbert gentoo-dev 2017-06-20 15:07:53 UTC
> 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:

pkg_postinst() {
   if systemd_is_booted; then
       elog "systemd timer unit X.timer has been installed."
       elog "Activate it with 'systemd enable X.timer'"
Comment 2 IntROOTER 2017-06-20 16:08:36 UTC
That is fine too.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-01-03 14:48:49 UTC
*** Bug 642150 has been marked as a duplicate of this bug. ***
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-01-03 14:49:01 UTC
*** Bug 642152 has been marked as a duplicate of this bug. ***
Comment 5 Mike Gilbert gentoo-dev 2019-01-06 22:25:51 UTC
man-db-2.8.5 installs a systemd timer unit.
Comment 6 Erik Quaeghebeur 2020-04-12 14:44:36 UTC
More inspiration for the timer/service files is provided by the Fedora package:
Comment 7 Larry the Git Cow gentoo-dev 2020-04-12 16:17:27 UTC
The bug has been closed via the following commit(s):

commit 0af088b41c694fbfd94e1db51a9df836eda0f7fd
Author:     Mike Gilbert <>
AuthorDate: 2020-04-12 16:06:19 +0000
Commit:     Mike Gilbert <>
CommitDate: 2020-04-12 16:17:13 +0000

    sys-apps/mlocate: modernize ebuild
    - EAPI=7
    - 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 <>

 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(+)