diff --git a/stages/org.osbuild.rpm b/stages/org.osbuild.rpm index a667245c..b22b59e0 100755 --- a/stages/org.osbuild.rpm +++ b/stages/org.osbuild.rpm @@ -202,6 +202,14 @@ def main(tree, inputs, options): "--define", macro, ] + env = os.environ.copy() + # update the environment with variables for kernel-install if any are defined + kernel_install_env = options.get("kernel_install_env", {}) + if kernel_install_env: + boot_root = kernel_install_env.get("boot_root") + if boot_root: + env["BOOT_ROOT"] = boot_root + with tempfile.NamedTemporaryFile(prefix="manifest.", mode='w') as manifest: manifest.writelines(c + '\n' for c in packages) manifest.flush() @@ -216,7 +224,7 @@ def main(tree, inputs, options): # reading. "--nosignature", "--install", manifest.name - ], cwd=pkgpath, check=True) + ], cwd=pkgpath, check=True, env=env) for key in options.get("gpgkeys.fromtree", []): path = os.path.join(tree, key.lstrip("/")) diff --git a/stages/org.osbuild.rpm.meta.json b/stages/org.osbuild.rpm.meta.json index 971c0c0f..a5051b02 100644 --- a/stages/org.osbuild.rpm.meta.json +++ b/stages/org.osbuild.rpm.meta.json @@ -146,6 +146,18 @@ "ostree_booted": { "type": "boolean", "description": "Create the '/run/ostree-booted' marker" + }, + "kernel_install_env": { + "description": "Set environment variables understood by kernel-install and plugins (kernel-install(8))", + "type": "object", + "additionalProperties": false, + "properties": { + "boot_root": { + "type": "string", + "pattern": "^\\/?(?!\\.\\.)((?!\\/\\.\\.\\/).)+$", + "description": "Sets $BOOT_ROOT for kernel-install to override $KERNEL_INSTALL_BOOT_ROOT, the installation location for boot entries" + } + } } } },