Use systemd sysusers config to create user and group

See: https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/
This commit is contained in:
Timothée Ravier 2021-10-15 20:52:44 +02:00
parent 4e9122c0eb
commit d892da15d1
2 changed files with 10 additions and 6 deletions

View File

@ -11,7 +11,7 @@
Name: gdm
Epoch: 1
Version: 41.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: The GNOME Display Manager
License: GPLv2+
@ -22,6 +22,8 @@ Source1: org.gnome.login-screen.gschema.override
# moved here from pulseaudio-gdm-hooks-11.1-16
Source5: default.pa-for-gdm
Source6: gdm.sysusers
# Downstream patches
Patch80001: 0001-Honor-initial-setup-being-disabled-by-distro-install.patch
Patch90001: 0001-data-add-system-dconf-databases-to-gdm-profile.patch
@ -140,6 +142,7 @@ mkdir -p %{buildroot}%{_sysconfdir}/gdm/PostSession
%meson_install
install -p -m644 -D %{SOURCE5} %{buildroot}%{_localstatedir}/lib/gdm/.config/pulse/default.pa
install -p -m644 -D %{SOURCE6} %{buildroot}%{_sysusersdir}/%{name}.conf
rm -f %{buildroot}%{_sysconfdir}/pam.d/gdm
@ -163,11 +166,7 @@ mkdir -p %{buildroot}%{_sysconfdir}/dconf/db/gdm.d/locks
%find_lang gdm --with-gnome
%pre
/usr/sbin/useradd -M -u 42 -d /var/lib/gdm -s /sbin/nologin -r gdm > /dev/null 2>&1
/usr/sbin/usermod -d /var/lib/gdm -s /sbin/nologin gdm >/dev/null 2>&1
# ignore errors, as we can't disambiguate between gdm already existed
# and couldn't create account with the current adduser.
exit 0
sysusers_create_compat %{SOURCE6}
%post
# if the user already has a config file, then migrate it to the new
@ -286,6 +285,7 @@ fi
%{_unitdir}/gdm.service
%dir %{_userunitdir}/gnome-session@gnome-login.target.d/
%{_userunitdir}/gnome-session@gnome-login.target.d/session.conf
%{_sysusersdir}/%{name}.conf
%files devel
%dir %{_includedir}/gdm
@ -300,6 +300,9 @@ fi
%{_libdir}/pkgconfig/gdm-pam-extensions.pc
%changelog
* Fri Oct 15 2021 Timothée Ravier <tim@siosm.fr> - 1:41.0-2
- Use systemd sysusers config to create user and group
* Tue Sep 21 2021 Kalev Lember <klember@redhat.com> - 1:41.0-1
- Update to 41.0

1
gdm.sysusers Normal file
View File

@ -0,0 +1 @@
u gdm 42 "GNOME Display Manager" /var/lib/gdm