-1

I was installing an rpm and satisfied the other needed rpm dependencies but still had a dependencie requiring a user and group entry (name=lp). I already have user and group named 'lp', so why doesn't rpm recognize them? More importantly how can I get rpm to recognize that the user+group dependencies are already satisfied?

If I am creating a spec file for an rpm, how can I specify in a spec file, that installation of said spec file satisfies some user and/or group dependency?

This doesn't seem to be something I would put in a %pre (that used to be how I might do it), but seems to be a dependency that is inserted (or detected) in the rpm database. I don't want to try to create a user/group on the system, only detect (or satisfy the need for such) in the rpm DB.

Here is the output of rpm, showing the "reqs" of the package.

rpm -q --requires  cups-config-2.3.3-3.1.x86_64.rpm
config(cups-config) = 2.3.3-3.1
group(lp) 
rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(PayloadIsZstd) <=> 5.4.18-1 
user(lp)
Astara
  • 229
  • 4
  • 9
  • Does this answer your question? [Create an RPM that can also manipulate files and add users](https://stackoverflow.com/questions/11197374/create-an-rpm-that-can-also-manipulate-files-and-add-users) – Aaron D. Marasco Aug 04 '23 at 22:49

2 Answers2

0

See Dynamic allocation section of Fedora Packaging Guidelines. You may even read a whole chapter.

msuchy
  • 5,162
  • 1
  • 14
  • 26
  • I don't want dynamic allocation for the user or groups. The user/group(s) already exist on the physical system, but not in the rpm DB. It's not clear that the section you point to allows for static specification of user/groups to be added to the DB for user/groups that already exist. – Astara Aug 21 '23 at 17:14
  • Also, dynamic allocation has nothing to do with why RPM isn't able to detect user/groups that already exist. What I need is how to do _Static_Allocation_ to define a user/group in the RPM database that already exists on the system where the package is being installed. This is purely to satisfy user/group prereqs that some packages specify. – Astara Aug 21 '23 at 17:19
  • The ,macro `%sysusers_create_compat` (that is referred in that linked doc) does that. It actually calls /usr/lib/rpm/sysusers.generate-pre.sh which calls `getent passwd $USER` and add the user only if the user does not already exists. – msuchy Aug 24 '23 at 10:02
  • And for static allocation, the workflow is the same. It is described in that referred documentation in section 'Soft static allocation' – msuchy Aug 24 '23 at 10:06
  • That's for using scriptlets to manage user/group. When testing for requisites, scriptlets aren't run. The requirement for a specific user/group seems to be a static requirement in the rpm as it is detectable as a 'requisite'. – Astara Aug 24 '23 at 22:38
-1

RPMs don't natively handle users/groups, you need to have them in your scriptlets. See this answer.

Well... Today I Learned...

So it seems RPM version 4.19 will support users and groups. The problem is, that as of today, the latest version available on rpm.org says "RPM 4.19.0 BETA released (Aug 02 2023)". So I don't know where you got the RPM, but it was built with BETA software.

That version of rpm is not going to be supported (yet) by any traditional distributions (e.g. Fedora).

Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39