stages: add new org.osbuild.bootc.install-to-filesystem
Support the `boot install to-filesystem` capability to install a bootc image to a filesystem.
This commit is contained in:
parent
a85b51bb2c
commit
226b50eba5
2 changed files with 68 additions and 0 deletions
62
stages/org.osbuild.bootc.install-to-filesystem
Executable file
62
stages/org.osbuild.bootc.install-to-filesystem
Executable file
|
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/python3
|
||||
"""Run bootc install to-filesystem
|
||||
|
||||
Note that this needs the disk.img in the inputs as one continous
|
||||
devices so that bootupd can install grub to the mbr.
|
||||
|
||||
Buildhost commands used: bootc
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import osbuild.api
|
||||
from osbuild.util import containers
|
||||
|
||||
CAPABILITIES = ["CAP_MAC_ADMIN"]
|
||||
|
||||
SCHEMA_2 = r"""
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["images"],
|
||||
"properties": {
|
||||
"images": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"additionalProperties": false
|
||||
},
|
||||
"devices": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"mounts": {
|
||||
"type": "array"
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def main(inputs, mounts):
|
||||
images = containers.parse_containers_input(inputs)
|
||||
assert len(images) == 1
|
||||
image = list(images.values())[0]
|
||||
|
||||
with containers.container_source(image) as (_, source):
|
||||
dst = mounts["root"]["path"]
|
||||
subprocess.run(
|
||||
["bootc", "install", "to-filesystem",
|
||||
"--source-imgref", source,
|
||||
"--skip-fetch-check", "--generic-image",
|
||||
dst],
|
||||
check=True
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args["inputs"], args["mounts"])
|
||||
sys.exit(r)
|
||||
Loading…
Add table
Add a link
Reference in a new issue