From 89617dfa6fb4f46b10d891afa4d2e9d9502e79c1 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Dec 21 2021 15:20:57 +0000 Subject: Add back Fedora < 32, EL7 and EL8 instructions 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. --- diff --git a/guidelines/modules/ROOT/pages/UsersAndGroups.adoc b/guidelines/modules/ROOT/pages/UsersAndGroups.adoc index 8c8f3fc..2abadff 100644 --- a/guidelines/modules/ROOT/pages/UsersAndGroups.adoc +++ b/guidelines/modules/ROOT/pages/UsersAndGroups.adoc @@ -135,6 +135,8 @@ In these cases, apply only the `+groupadd+` parts of the below recipes. === Dynamic allocation +==== Fedora >= 32 + To create users and groups in packages using dynamic allocation, do the following: Create a `.sysusers` file with the user definition and add it to the specfile as a source. @@ -165,6 +167,23 @@ install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/munge.conf [...] ``` +==== Fedora < 32, EL7 and EL8 + +In older versions the `%sysusers_create_compat` macro is unavailable. +To create users and groups in packages using dynamic allocation, use the following: + +.... +Requires(pre): shadow-utils +[...] + +%pre +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 +.... + === Soft static allocation To allocate a UID and/or GID,