]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add InitrdPackages= 1942/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 30 Sep 2023 18:16:24 +0000 (20:16 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 1 Oct 2023 16:45:43 +0000 (18:45 +0200)
We have ToolsTreePackages= already, so let's add a similar setting
for the default initrd to allow the default initrd to be used in
more scenarios.

mkosi/__init__.py
mkosi/config.py
mkosi/resources/mkosi.md

index fa2a9b9777b85affca3e525b040bb02fd0515ba5..dfd9b066af8e89c0647b0e534a54f7d19cf46071 100644 (file)
@@ -1002,6 +1002,7 @@ def build_initrd(state: MkosiState) -> Path:
         "--package", "util-linux",
         "--package", "kmod",
         *(["--package", "dmsetup"] if state.config.distribution.is_apt_distribution() else []),
+        *flatten(["--package", package] for package in state.config.initrd_packages),
         "--output", f"{state.config.output}-initrd",
         *(["--image-version", state.config.image_version] if state.config.image_version else []),
         "--make-initrd", "yes",
index e987d559402526e666ceeee70c36e6934c12eb62..b5dda1b50fe5131b51030ec752920384880d6d8d 100644 (file)
@@ -728,6 +728,7 @@ class MkosiConfig:
     bootloader: Bootloader
     bios_bootloader: BiosBootloader
     initrds: list[Path]
+    initrd_packages: list[str]
     kernel_command_line: list[str]
     kernel_modules_include: list[str]
     kernel_modules_exclude: list[str]
@@ -1361,6 +1362,14 @@ SETTINGS = (
         parse=config_make_list_parser(delimiter=",", parse=make_path_parser(required=False)),
         help="Add a user-provided initrd to image",
     ),
+    MkosiConfigSetting(
+        dest="initrd_packages",
+        long="--initrd-package",
+        metavar="PACKAGE",
+        section="Content",
+        parse=config_make_list_parser(delimiter=","),
+        help="Add additional packages to the default initrd",
+    ),
     MkosiConfigSetting(
         dest="kernel_command_line",
         metavar="OPTIONS",
@@ -2449,6 +2458,7 @@ Clean Package Manager Metadata: {yes_no_auto(config.clean_package_metadata)}
                     Bootloader: {config.bootloader}
                BIOS Bootloader: {config.bios_bootloader}
                        Initrds: {line_join_list(config.initrds)}
+               Initrd Packages: {line_join_list(config.initrd_packages)}
            Kernel Command Line: {line_join_list(config.kernel_command_line)}
         Kernel Modules Include: {line_join_list(config.kernel_modules_include)}
         Kernel Modules Exclude: {line_join_list(config.kernel_modules_exclude)}
index 8487b713228437fa5a09c15fd64664506fcf477e..95231d83eb0cc3982c0c560a96b2ca3157e15cd7 100644 (file)
@@ -874,7 +874,14 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
 
 : Use user-provided initrd(s). Takes a comma separated list of paths to
   initrd files. This option may be used multiple times in which case the
-  initrd lists are combined.
+  initrd lists are combined. If no initrds are specified and a bootable
+  image is requested, mkosi will automatically build a default initrd.
+
+`InitrdPackages=`, `--initrd-package=`
+
+: Extra packages to install into the default initrd. Takes a comma
+  separated list of package specifications. This option may be used
+  multiple times in which case the specified package lists are combined.
 
 `KernelCommandLine=`, `--kernel-command-line=`