plocate: better integration

* add _plocate group
* add locate alternative group
* simple pupdatedb script that does mupdatedb and plocate-build
* ship our own cron job that uses the _plocate group
This commit is contained in:
Duncaen 2020-10-31 20:04:53 +01:00
parent f1a6e6d4f1
commit f84af8e70c
No known key found for this signature in database
GPG key ID: 335C1D17EC3D6E35
4 changed files with 35 additions and 1 deletions

7
srcpkgs/plocate/INSTALL Normal file
View file

@ -0,0 +1,7 @@
# INSTALL
case "$ACTION" in
post)
chown root:_plocate usr/bin/plocate
chmod 2755 usr/bin/plocate
;;
esac

View file

@ -0,0 +1,5 @@
#!/bin/sh
set -e
plocate-build /var/lib/mlocate/mlocate.db /var/lib/mlocate/plocate.db.new
chgrp _plocate /var/lib/mlocate/plocate.db.new
mv /var/lib/mlocate/plocate.db.new /var/lib/mlocate/plocate.db

View file

@ -0,0 +1,8 @@
#!/bin/sh
# pupdatedb [database directory] - update a database for plocate
set -e
dbdir=${1:-${DBDIR:-/var/lib/mlocate}}
mupdatedb -o "${dbdir}/mlocate.db"
plocate-build "${dbdir}/mlocate.db" "${dbdir}/plocate.db.new"
chgrp _plocate "${dbdir}/plocate.db.new"
mv "${dbdir}/plocate.db.new" "${dbdir}/plocate.db"

View file

@ -1,7 +1,7 @@
# Template file for 'plocate'
pkgname=plocate
version=1.0.6
revision=1
revision=2
build_style=meson
hostmakedepends="pkg-config"
makedepends="libzstd-devel"
@ -13,7 +13,21 @@ homepage="https://plocate.sesse.net/"
distfiles="https://plocate.sesse.net/download/plocate-${version}.tar.gz"
checksum=48338c46afca22fd6f57faf69b7816cb70516d9279eb1e5d9895a14c87dbd617
system_accounts="_plocate"
alternatives="
locate:locate:/usr/bin/plocate
locate:locate.1:/usr/share/man/man1/plocate.1
locate:updatedb:/usr/bin/pupdatedb"
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
makedepends+=" libatomic-devel"
LIBS="-latomic"
fi
post_install() {
# replace daily cronjob with our own version
rm ${DESTDIR}/etc/cron.daily/plocate
vinstall ${FILESDIR}/plocate.cron-daily 744 etc/cron.daily plocate-build
vbin ${FILESDIR}/pupdatedb
}