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>
Mon, 24 May 2021 19:41:24 +0000 (21:41 +0200)
commit82855aa610510ddacf72bec03629839a7829e3b7
treece8d60cdf86521fe96e507f9bb73e44e02328d1c
parent0520564dcf3e0adc8eb140f149c93351481c446c
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.
src/sysusers/sysusers.c