While Fedora < 32 is not relevant since it's unsupported, EL7 and EL8 are due to EPEL. Ideally speaking the macro would be available there as well, but this fills the gap for now.
I don't think Fedora < 32 should be mentioned here as well. I don't mind including EPEL notes, but the guidelines are not for EPEL.
Fedora < 32
It's quite common for packagers to use a single spec for both Fedora and EPEL. Should we recommend using macros to use the newer style if available? Something like:
%if !0%{rhel} || 0%{rhel} >= 9 BuildRequires: systemd-rpm-macros %endif %if 0%{rhel} && 0%{rhel} < 9 Requires(pre): shadow-utils %endif
I think installing the sysusers file can happen unconditionally. Then %pre would become
%pre
%pre %if !0%{rhel} || 0%{rhel} >= 9 %sysusers_create_compat %{SOURCE3} %endif %if 0%{rhel} && 0%{rhel} < 9 getent group GROUPNAME >/dev/null || groupadd -r GROUPNAME getent passwd USERNAME >/dev/null || \ useradd -r -g GROUPNAME -d HOMEDIR -s /sbin/nologin \ -c "Useful comment about the purpose of this account" USERNAME exit 0 %endif
That said, it was pointed out that there's an EPEL guide. I'd be happy to send a PR there that describes this. Once that's merged, this guide can link to it with a warning for EPEL packagers.
https://docs.fedoraproject.org/en-US/epel/epel-packaging/
Pull-Request has been closed by tibbs
While Fedora < 32 is not relevant since it's unsupported, EL7 and EL8 are due to EPEL. Ideally speaking the macro would be available there as well, but this fills the gap for now.