sysusers: make sysusers work with dnf --installroot
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 24 May 2021 09:34:16 +0000 (11:34 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 9 Jul 2021 16:27:15 +0000 (18:27 +0200)
commit1391fed8408968b1338ce60e830b569bc449097f
tree7e5e53c97b1ee72535d6cea6fb914331742ff325
parent7cd20415cfaa808791f7a650c7799802f6cb825a
sysusers: make sysusers work with dnf --installroot

This is not very pretty, but the code in fs-util.c already provisions for
missing /proc. We ourselves are careful to set up /proc, but not everybody
is and it is important for sysusers to also work where shadow-utils would:
I would like to replace calls to useradd and groupadd in Fedora systemd rpm
scriptlets with a call to sysusers. It has a number of advantages:
- dogfooding
- we don't need to manually duplicate the information from our sysusers
  files to scriptlets
- a dependency on shadow-utils is dropped, which transitively drops dependencies
  on setup and fedora-repos and bunch of other stuff.

We could try to get 'dnf' and 'rpm --root' and such to be reworked,
but not in any reasonable timeframe. And even if this was done, we'd still
want to support older rpm/dnf versions.

(cherry picked from commit 82855aa610510ddacf72bec03629839a7829e3b7)
src/sysusers/sysusers.c