]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add groupadd script 2246/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 5 Jan 2024 13:26:06 +0000 (14:26 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 5 Jan 2024 13:26:06 +0000 (14:26 +0100)
NEWS.md
mkosi/__init__.py
mkosi/resources/mkosi.md

diff --git a/NEWS.md b/NEWS.md
index 3f24d20458ec1ea86a35b3c2192c2f2d94285a8a..e3ad909a35461fa1bfaf092b719d9fcf417f9fb9 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -59,8 +59,8 @@
   `KernelModulesInitrdIncludeHost=` to only include modules loaded on
   the host system in the image/initrd respectively.
 - Implemented `RemovePackages=` for Arch Linux.
-- Added `useradd` script to configure `useradd` to operate on the image
-  during builds instead on the host.
+- Added `useradd` and `groupadd` scripts to configure these binaries to
+  operate on the image during builds instead on the host.
 - Added microcode support. If installed into the image, an early
   microcode initrd will automatically be built and prepended to the
   initrd.
index ba200f2fe6f9fae900c6fe317442068d41f5d685..22a0a59a281ac40cda9ea28d73339feff94554c0 100644 (file)
@@ -396,8 +396,9 @@ def finalize_host_scripts(
     scripts: dict[str, Sequence[PathString]] = {}
     if find_binary("git"):
         scripts["git"] = ("git", "-c", "safe.directory=*")
-    if find_binary("useradd"):
-        scripts["useradd"] = ("useradd", "--root", context.root)
+    for binary in ("useradd", "groupadd"):
+        if find_binary(binary):
+            scripts[binary] = (binary, "--root", context.root)
     return finalize_scripts(scripts | helpers | package_manager_scripts(context))
 
 
index 66a6f541dbc88770030fb57fbab323fab987f298..2fd346f59111580e1811fc67b27c956a6c1f4a71 100644 (file)
@@ -1914,8 +1914,8 @@ available via `$PATH` to simplify common usecases.
 * `git` is automatically invoked with `safe.directory=*` to avoid
   permissions errors when running as the root user in a user namespace.
 
-* `useradd` is automatically invoked with `--root=$BUILDROOT` when
-  executed outside of the image.
+* `useradd` and `groupadd` are automatically invoked with
+  `--root=$BUILDROOT` when executed outside of the image.
 
 When scripts are executed, any directories that are still writable are
 also made read-only (`/home`, `/var`, `/root`, ...) and only the minimal