https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers simplifies
the creation of system users and groups: the package only has to provide a
sysusers.d config file as part of the payload and rpm will implement this
configuration before the package is installed.
Before this patch, %sysusers_create_compat was the only documented way to
create users and groups. The traditional approach with getent/useradd/groupadd
was dropped a few years ago (6d066acbb1:
'UsersAndGroups: Use %sysusers_create_compat macro', 2020-12-10). So what this
patch effectively does is to drop the requirement for the sysusers file to be a
separate Source and to call %sysusers_create_compat in F42+.
Some packages still use the old old approach of manual getent/useradd/groupadd
scriptlets. This hasn't been documented for the last four years. We generally
do not require packages to update when packaging guidelines are changed, so
those packages are "fine", but we want them to switch to provide sysusers
files.
The transition plan is:
- spec files only for F42+ only need to provide a sysusers file
- spec files for F42- or compatible with both are recommended to use
the previously-described approach with %sysusers_create_compat.
- spec files which use the old old approach can switch to
%sysusers_create_compat (if a single spec file is to be used in
multiple branches), or just switch to the new approach in the
rawhide branch.
While packages that create users via scriptlets will continue to work, we want
to switch all packages to the new scheme. We have dependencies between packages
that create and use system accounts. Rpm will automatically create dependencies
on user and group accounts for files that are the package payload. Currently
those dependencies are weak (Recommends), and the first attempt to switch to
strong dependencies caused installability issues. But once we have sysusers.d
definitions for all users/groups used by packages, we can switch those
dependencies to strong (Requires). Thus we need to provide full sysusers.d
coverage of users to allow robust sorting of packages during install.
Once this is merged, I'll change the %sysusers_create_compat and
%sysusers_requires_compat to be empty.
The scriptlets were removed in 6d066acbb1:
'UsersAndGroups: Use %sysusers_create_compat macro', 2020-12-10.
That explanation was left behind, but it doesn't make sense without
the scriptlets, and the variables like USERNAME/GROUPNAME/HOMEDIR
are not used anywhere either.