#1135 Update guidelines/modules/ROOT/pages/UsersAndGroups.adoc
Opened 2 years ago by mmarkk. Modified 2 years ago
mmarkk/packaging-committee sysusers  into  master

@@ -137,32 +137,28 @@ 

  

  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):

  ```

+ Source3: %{name}-sysusers.conf

  [...]

- BuildRequires:  systemd-rpm-macros

- 

+ BuildRequires: systemd-rpm-macros

+ [...]

+ Requires(pre): /usr/bin/systemd-sysusers

  [...]

  %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}

- 

+ %sysusers_create_package %{name} %{SOURCE3}

  [...]

  %files

- %{_sysusersdir}/munge.conf

- [...]

+ %{_sysusersdir}/%{name}.conf

  ```

  

  === Soft static allocation

no initial comment

rebased onto 31f2ed89acd54f68a263ec80a2033fca444bf2a4

2 years ago

rebased onto ac55e48596fe3ed06047ef2ee629128e516b2be4

2 years ago

I'm unsure how to make it correct. Actually, two different packages provide the file.

I think we should leave it here. If you strongly consider this should be deleted - I will remove.

@oturpe Please review. It's my first PR to pagure.io. I'm new to the system, sorry for closing previous PRs.

@oturpe Please review. It's my first PR to pagure.io. I'm new to the system, sorry for closing previous PRs.

Unfortunately, I cannot do a full review, nor approve this pull request.
The main reason is that I am not in the Packaging Committee.
Also, I am not familiar with sysysers.
I just subscribe to notifications to see what is going on,
and decided to comment because I was wondering about mentioning end-of-life releases.
I should have explained this in the original comment.

However, I can give another random bit of feedback:
in the BuildRequires:, use %{_bindir} instead of /usr/bin.

rebased onto 963be167d58a4822947203249ee9b5ab8043a758

2 years ago

As I said in https://pagure.io/packaging-committee/pull-request/1077#comment-160052, we probably can not change the way we setup users (moving from our macro to systemd-sysusers) without a system wide change request.

A good first step to get there would be to go over all the packages and move them to the new sysusers format first (which is something I'm slowly and progressively doing) and then we can do a simple macro switch behind the scene to switch all packages at once in a coherent fashion.

However, I can give another random bit of feedback:
in the BuildRequires:, use %{_bindir} instead of /usr/bin.

This is not a good idea. %{_bindir} might be modified by some additional %{_prefix}, like /app during RPM builds for Fedora flatpaks. This is one of the reasons why using the fully expanded expected path of binaries instead of using macros is the right thing to do in BuildRequires. (Those paths are not determined by the value of %{_bindir} in the current package, but by the value of %{_bindir} during the build process of the package that contains that binary, and those two values might not necessarily be the same.

@siosm I do not understand why we can't change packaging recommendations right now ? AFAIK it works, and we don't have to change all the packages to this new system, because all previous macroses still work.

rebased onto 2fdc12d0a94b42577602bfa3c834c39ea2c8f2ea

2 years ago

However, I can give another random bit of feedback:
in the BuildRequires:, use %{_bindir} instead of /usr/bin.

This is not a good idea. %{_bindir} might be modified by some additional %{_prefix}, like /app during RPM builds for Fedora flatpaks. This is one of the reasons why using the fully expanded expected path of binaries instead of using macros is the right thing to do in BuildRequires. (Those paths are not determined by the value of %{_bindir} in the current package, but by the value of %{_bindir} during the build process of the package that contains that binary, and those two values might not necessarily be the same.

OKAY, changed back to /usr/bin

rebased onto 4668c35c72d4faa25ddd15e04599217c945f26d3

2 years ago

rebased onto 8bc89cd

2 years ago
Metadata