| |
@@ -137,32 +137,66 @@
|
| |
|
| |
To create users and groups in packages using dynamic allocation, do the following:
|
| |
|
| |
- Create a `<package-name>.sysusers` file with the user definition and add it to the specfile as a source.
|
| |
+ Create a `<package-name>-sysusers.conf` file with the user definition and add it to the specfile as a source.
|
| |
For example for the `munge` package, this file contains:
|
| |
```
|
| |
#Type Name ID GECOS Home directory Shell
|
| |
u munge - "Runs Uid 'N' Gid Emporium" /run/munge /sbin/nologin
|
| |
```
|
| |
|
| |
- In the specfile, add a BuildRequires for systemd-rpm-macros, install the sysusers file,
|
| |
- and use the `%sysusers_create_compat` macro to consume it in the `%pre` section
|
| |
- (in this example the sysusers config file is `Source3` of the specfile):
|
| |
+ For different Fedora version, different macroses are recommended. Use the following hints:
|
| |
+
|
| |
+ For Fedora 32 and lower:
|
| |
```
|
| |
+ Source3: %{name}-sysusers.conf
|
| |
[...]
|
| |
BuildRequires: systemd-rpm-macros
|
| |
-
|
| |
+ %sysusers_requires_compat
|
| |
[...]
|
| |
%install
|
| |
- install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/munge.conf
|
| |
-
|
| |
+ install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf
|
| |
[...]
|
| |
%pre
|
| |
%sysusers_create_compat %{SOURCE3}
|
| |
+ [...]
|
| |
+ %files
|
| |
+ %{_sysusersdir}/%{name}.conf
|
| |
+ ```
|
| |
|
| |
+ For Fedora 33:
|
| |
+ ```
|
| |
+ Source3: %{name}-sysusers.conf
|
| |
+ [...]
|
| |
+ BuildRequires: systemd-rpm-macros
|
| |
+ [...]
|
| |
+ Requires(pre): /usr/bin/systemd-sysusers
|
| |
+ [...]
|
| |
+ %install
|
| |
+ install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf
|
| |
+ [...]
|
| |
+ %pre
|
| |
+ %sysusers_create %{SOURCE3}
|
| |
[...]
|
| |
%files
|
| |
- %{_sysusersdir}/munge.conf
|
| |
+ %{_sysusersdir}/%{name}.conf
|
| |
+ ```
|
| |
+
|
| |
+ Fedora 34 and higher:
|
| |
+ ```
|
| |
+ Source3: %{name}-sysusers.conf
|
| |
+ [...]
|
| |
+ BuildRequires: systemd-rpm-macros
|
| |
+ [...]
|
| |
+ Requires(pre): /usr/bin/systemd-sysusers
|
| |
[...]
|
| |
+ %install
|
| |
+ install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}.conf
|
| |
+ [...]
|
| |
+ %pre
|
| |
+ %sysusers_create_package %{name} %{SOURCE3}
|
| |
+ [...]
|
| |
+ %files
|
| |
+ %{_sysusersdir}/%{name}.conf
|
| |
```
|
| |
|
| |
=== Soft static allocation
|
| |