From e2a1a1cdda0be6771cc33500c78138fdf91ca800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 29 Jan 2025 14:46:36 +0100 Subject: [PATCH] Add sysusers.d config file to allow rpm to create users/groups automatically See https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers. Resolves: RHEL-109037 --- dbus-broker.spec | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/dbus-broker.spec b/dbus-broker.spec index 156aa30..73fb998 100644 --- a/dbus-broker.spec +++ b/dbus-broker.spec @@ -21,7 +21,6 @@ BuildRequires: glibc-devel BuildRequires: meson BuildRequires: python3-docutils Requires: dbus-common -Requires(pre): shadow-utils %description dbus-broker is an implementation of a message bus as defined by the D-Bus @@ -33,6 +32,11 @@ recent Linux kernel releases. %prep %autosetup -p1 +# Create a sysusers.d config file +cat >dbus-broker.sysusers.conf </dev/null || groupadd -f -g %{dbus_user_id} -r dbus -if ! getent passwd dbus >/dev/null ; then - if ! getent passwd %{dbus_user_id} >/dev/null ; then - useradd -r -u %{dbus_user_id} -g %{dbus_user_id} -d '/' -s /sbin/nologin -c "System message bus" dbus - else - useradd -r -g %{dbus_user_id} -d '/' -s /sbin/nologin -c "System message bus" dbus - fi -fi -exit 0 - %post %systemd_post dbus-broker.service %systemd_user_post dbus-broker.service @@ -89,6 +83,7 @@ fi %{_mandir}/man1/dbus-broker-launch.1* %{_unitdir}/dbus-broker.service %{_userunitdir}/dbus-broker.service +%{_sysusersdir}/dbus-broker.conf %changelog %autochangelog