Add sysusers.d config file to allow rpm to create users/groups automatically

See https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2025-02-11 17:03:11 +01:00
commit 9cea29928b

View file

@ -274,7 +274,6 @@ See also the "uuid-devel" package, which is a separate implementation.
Summary: Helper daemon to guarantee uniqueness of time-based UUIDs
Requires: libuuid = %{version}-%{release}
License: GPL-2.0-only
Requires(pre): shadow-utils
%{?systemd_ordering}
%description -n uuidd
@ -314,6 +313,11 @@ The utilities scripts, scriptreplay, and scriptlive are used to create and repla
%prep
%autosetup -p1 -n %{name}-%{upstream_version}
# Create a sysusers.d config file
cat >util-linux.sysusers.conf <<EOF
u uuidd - 'UUID generator helper daemon' /var/lib/libuuid -
EOF
%build
unset LINGUAS || :
@ -467,6 +471,8 @@ find %{buildroot}%{_mandir}/man8 -regextype posix-egrep \
mv -v %{buildroot}/usr/sbin/* %{buildroot}/usr/bin/
%endif
install -m0644 -D util-linux.sysusers.conf %{buildroot}%{_sysusersdir}/util-linux.conf
%post
%systemd_post fstrim.{service,timer}
@ -478,12 +484,6 @@ mv -v %{buildroot}/usr/sbin/* %{buildroot}/usr/bin/
%systemd_postun fstrim.service
%pre -n uuidd
getent group uuidd >/dev/null || groupadd -r uuidd
getent passwd uuidd >/dev/null || \
useradd -r -g uuidd -d /var/lib/libuuid -s /sbin/nologin \
-c "UUID generator helper daemon" uuidd
exit 0
# Please, keep uuidd running after installation! Note that systemd_post is
# "systemctl preset" and it enable/disable service only.
%post -n uuidd
@ -899,6 +899,7 @@ fi
%{compldir}/uuidd
%{_tmpfilesdir}/uuidd-tmpfiles.conf
%{_sysusersdir}/uuidd.conf
%{_sysusersdir}/util-linux.conf
%files -n libfdisk