stages/rpm: add new kernel_install_env options
Add support for setting environment variables for kernel-install and its plugins. These can be used to control the behaviour of kernel-install during the kernel rpm installation. Currently, we only add support for $BOOT_ROOT, which we need to control the path where the kernel should be installed. Normally, kernel-install scripts will detect the correct path based on the filesystem layout, specifically the ESP path. However, during our installation the filesystem is not yet set up, so with this option, we can control the installation path based on the location we know the ESP will be mounted in the final image. This is a very similar override to what we do with the org.osbuild.fix-bls stage. The stage option is added under a kernel_install_env object so we can potentially support more of the known env vars in the future.
This commit is contained in:
parent
7be822d6e9
commit
305a54f1a2
2 changed files with 21 additions and 1 deletions
|
|
@ -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("/"))
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue