stages/bootc.install: make boot and root mount spec customizable

Allow passing custom mount specs for boot and root. Optional fields.
This commit is contained in:
jbtrystram 2025-07-21 20:49:13 +02:00 committed by Simon de Vlieger
parent 825045a914
commit e930eeb519
2 changed files with 31 additions and 2 deletions

View file

@ -46,6 +46,23 @@ def main(options, inputs, paths):
stateroot = options.get("stateroot")
if stateroot:
pargs.extend(["--stateroot", stateroot])
# Passing the flag with an empty value is intentional:
# it triggers a supported behaviour where mountspec
# kernel arguments are ommited.
# See https://github.com/bootc-dev/bootc/pull/1451
if "root-mount-spec" in options:
root_spec = options["root-mount-spec"]
if root_spec == "":
pargs.extend(["--root-mount-spec="])
else:
pargs.extend(["--root-mount-spec", root_spec])
if "boot-mount-spec" in options:
boot_spec = options["boot-mount-spec"]
if boot_spec == "":
pargs.extend(["--boot-mount-spec="])
else:
pargs.extend(["--boot-mount-spec", boot_spec])
# add target and go
pargs.append(dst)
subprocess.run(pargs, env=env, check=True)

View file

@ -7,12 +7,16 @@
"mounted in the \"mounts\" path.",
"Buildhost commands used: bootc"
],
"capabilities": ["CAP_MAC_ADMIN"],
"capabilities": [
"CAP_MAC_ADMIN"
],
"schema_2": {
"inputs": {
"type": "object",
"additionalProperties": false,
"required": ["images"],
"required": [
"images"
],
"properties": {
"images": {
"type": "object",
@ -44,6 +48,14 @@
"stateroot": {
"type": "string",
"description": "The stateroot name to use. If not specified, defer to bootc's default"
},
"root-mount-spec": {
"type": "string",
"description": "Source device specification for the root filesystem. If not provided, the UUID of the target filesystem will be used."
},
"boot-mount-spec": {
"type": "string",
"description": "Mount specification for the /boot filesystem. If `/boot` is detected as a mounted partition, then its UUID will be used."
}
}
},