cd obj
ninja
sudo ninja install
+ sudo addgroup plocate
+ sudo systemctl enable plocate-updatedb.timer
To build the database for the first time after install, you can do
- sudo addgroup mlocate
sudo updatedb
The initial run of updatedb needs to scan the entire filesystem.
install_man('plocate.1')
install_man('plocate-build.8')
+if get_option('install_systemd')
+ systemd = dependency('systemd', required: false)
+ if systemd.found()
+ unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+ updatedb_service = configure_file(input: 'plocate-updatedb.service.in',
+ output: 'plocate-updatedb.service',
+ configuration: conf_data)
+ install_data(updatedb_service, install_dir: unitdir)
+ install_data('plocate-updatedb.timer', install_dir: unitdir)
+ endif
+endif
+
# Requires having TurboPFor checked out, so not built by default.
# Unless you have a recent Meson, there's no apparently good way
# of calling into that directory to run make, and we're not
-option('install_cron', type: 'boolean', value: true, description: 'Install update script into /etc/cron.daily')
+option('install_cron', type: 'boolean', value: false, description: 'Install mlocate conversion script into /etc/cron.daily')
+option('install_systemd', type: 'boolean', value: true, description: 'Install systemd service and timer for updatedb, if systemd is installed')
option('locategroup', type: 'string', value: 'plocate', description: 'Group that the install script will use for the .db file')
--- /dev/null
+[Unit]
+Description=Update the plocate database
+ConditionACPower=true
+
+[Service]
+Type=oneshot
+ExecStart=@sbindir@/updatedb
+LimitNOFILE=131072
+IOSchedulingClass=idle
+
+PrivateTmp=true
+PrivateDevices=true
+PrivateNetwork=true
+ProtectSystem=full
--- /dev/null
+[Unit]
+Description=Update the plocate database daily
+
+[Timer]
+OnCalendar=daily
+Persistent=true
+
+[Install]
+WantedBy=timers.target