Migrate to systemd-tmpfiles

Resolves: RHEL-104995
This commit is contained in:
Michal Sekletar 2026-04-01 14:43:50 +02:00
parent 87e7a0a933
commit 138b0b4c0f
2 changed files with 11 additions and 2 deletions

View File

@ -12,6 +12,7 @@ License: GPL-2.0-or-later AND GPL-2.0-only
URL: https://plocate.sesse.net/
Source0: https://plocate.sesse.net/download/plocate-%{version}.tar.gz
Source1: plocate.sysusers
Source2: plocate.tmpfiles
Patch1: 0001-Avoid-writing-uninitialized-header-data.patch
Patch2: 0002-Don-t-leak-file-descriptor.patch
@ -23,6 +24,7 @@ BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(liburing)
BuildRequires: pkgconfig(libzstd)
BuildRequires: libatomic
Requires(post): systemd-tmpfiles
# The plan is to provide both mlocate and plocate for one or two
# Fedora releases, and then retire mlocate when the bugs in plocate
@ -62,6 +64,9 @@ EOF
%meson_install
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/plocate.conf
install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/plocate.conf
# Let tmpfiles create the state directory at install/boot time.
rm -rf %{buildroot}%{_sharedstatedir}/plocate
ln -s plocate %{buildroot}%{_bindir}/locate
install -p -D -m 0644 -t %{buildroot}%{_mandir}/man1/ locate.1
install -p -D -m 0644 -t %{buildroot}%{_sysconfdir}/ updatedb.conf
@ -75,6 +80,7 @@ install -p -D -m 0644 -t %{buildroot}%{_sysconfdir}/ updatedb.conf
%post
%systemd_post plocate-updatedb.service plocate-updatedb.timer
%tmpfiles_create %{_tmpfilesdir}/plocate.conf
if [ $1 == 1 ] && [ -d /run/systemd ]; then
touch %{plocate_start_now} || :
@ -113,9 +119,10 @@ fi
%_mandir/man8/plocate-build.8*
%_mandir/man8/updatedb.8*
%_sysusersdir/plocate.conf
%{_tmpfilesdir}/plocate.conf
%config(noreplace) %{_sysconfdir}/updatedb.conf
%dir %{_sharedstatedir}/plocate
%{_sharedstatedir}/plocate/CACHEDIR.TAG
%ghost %attr(0755,root,root) %dir %{_sharedstatedir}/plocate
%ghost %attr(0644,root,root) %{_sharedstatedir}/plocate/CACHEDIR.TAG
%ghost %attr(0640,-,plocate) %verify(not md5 mtime) %{_sharedstatedir}/plocate/plocate.db
%changelog

2
plocate.tmpfiles Normal file
View File

@ -0,0 +1,2 @@
d /var/lib/plocate 0755 root root -
f /var/lib/plocate/CACHEDIR.TAG 0644 root root - Signature: 8a477f597d28d172789f06886806bc55\n# This file is a cache directory tag created by plocate.\n# For information about cache directory tags, see:\n#\thttps://bford.info/cachedir/\n