guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#34730] [PATCH 0/4] Add (gnu build accounts) and use it to create /e


From: Ludovic Courtès
Subject: [bug#34730] [PATCH 0/4] Add (gnu build accounts) and use it to create /etc/passwd & co.
Date: Mon, 4 Mar 2019 12:12:13 +0100

Hello Guix!

This patch series adds a new module, (gnu build accounts), and
uses it to create /etc/{passwd,group,shadow} upon system activation.

This replaces functionality currently provided by the Shadow
command-line tools (‘useradd’, ‘usermod’, etc.) and libc (‘getspnam’,
‘putpwent’, and all these wonderful APIs.)

It’s more code on our side, but it’s overall much less code involved
to create those databases.  The code makes the UID/GID allocation
strategy and state handling (preserving passwords and UIDs/GIDs, not
reusing currently-used UIDs/GIDs, etc.) much clearer and auditable.
Previously all this was buried in imperative calls to ‘useradd’ & co.,
which in turn have an ID allocation strategy baked deep down into
the Shadow code.

As a side effect the system boots slightly faster and we get PIDs
starting at ~190 instead of ~300 on a bare-bones system.  :-)

Feedback welcome!

Ludo’.

Ludovic Courtès (4):
  system: Add (gnu system accounts).
  activation: Operate on <user-account> and <user-group> records.
  Add (gnu build accounts).
  activation: Build account databases with (gnu build accounts).

 Makefile.am              |   1 +
 gnu/build/accounts.scm   | 561 +++++++++++++++++++++++++++++++++++++++
 gnu/build/activation.scm | 245 +++--------------
 gnu/build/install.scm    |   3 +-
 gnu/local.mk             |   2 +
 gnu/system/accounts.scm  | 109 ++++++++
 gnu/system/shadow.scm    |  92 +++----
 tests/accounts.scm       | 309 +++++++++++++++++++++
 8 files changed, 1061 insertions(+), 261 deletions(-)
 create mode 100644 gnu/build/accounts.scm
 create mode 100644 gnu/system/accounts.scm
 create mode 100644 tests/accounts.scm

-- 
2.21.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]