#1158 Scriptlets for adding users and groups
Opened 2 years ago by xvitaly. Modified 2 years ago

Can new packages use the legacy way of creating users and groups or they must use only the modern one?

getent group foo >/dev/null || %{_sbindir}/groupadd -r foo
getent passwd foo >/dev/null || \
  %{_sbindir}/useradd -r -g foo -s %{_sbindir}/nologin \
                      -d %{_sharedstatedir}/foo -c 'foo Service' foo

Such legacy scriptlets are incompatible with Silverblue, I guess.


And what about many existing packages that use this method? Should all of them be changed?
Also, what about this guideline
https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/
that says:

Sites that only want to customize the UIDs and GIDs of a few nonessential services may write a script to create the entries with useradd and groupadd and install our package afterwards.

Should this guideline be changed as well?

Is there a reason why you don't want to use the new methods?

Yes, it causes problems if you try to run commands directly from rpm.

The section you listed is not about packaging for Fedora:

Sites that only want to customize the UIDs and GIDs of a few nonessential services may write a script to create the entries with useradd and groupadd and install our package afterwards

Note that the new way is not compatible with containers without systemd
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=1740545

The guidelines say to use the new way with a macro that does the old way. :)

Login to comment on this ticket.

Metadata