stages/ostree: add ref support
Add a new optional `ref` option. When set, a references for the commit that was pulled with the value of `ref` will be created in the system ostree repo. It will also be used when deploying the commit and thus will be set as the origin for it. This is necessary for updates to work.
This commit is contained in:
parent
cc01eb3a0e
commit
3eea0668f9
1 changed files with 16 additions and 7 deletions
|
|
@ -42,6 +42,10 @@ STAGE_OPTS = """
|
|||
"description": "Additional kernel command line options",
|
||||
"type": "string"
|
||||
},
|
||||
"ref": {
|
||||
"description": "OStree ref to create and use for deployment",
|
||||
"type": "string"
|
||||
},
|
||||
"rootfs": {
|
||||
"description": "Identifier to locate the root file system",
|
||||
"type": "string"
|
||||
|
|
@ -104,18 +108,23 @@ def main(tree, sources, options):
|
|||
rootfs = options["rootfs"]
|
||||
mounts = options.get("mounts", [])
|
||||
kopts = options.get("kernel_opts", [])
|
||||
|
||||
print(f"Fetching ostree commit {commit}")
|
||||
osbuild.sources.get("org.osbuild.ostree", [commit])
|
||||
ref = options.get("ref", commit)
|
||||
|
||||
ostree("admin", "init-fs", "--modern", tree,
|
||||
sysroot=tree)
|
||||
|
||||
ostree("pull-local",
|
||||
f"{sources}/org.osbuild.ostree/repo",
|
||||
commit,
|
||||
print(f"Fetching ostree commit {commit}")
|
||||
osbuild.sources.get("org.osbuild.ostree", [commit])
|
||||
|
||||
source_repo = f"{sources}/org.osbuild.ostree/repo"
|
||||
|
||||
ostree("pull-local", source_repo, commit,
|
||||
repo=f"{tree}/ostree/repo")
|
||||
|
||||
if ref != commit:
|
||||
ostree("refs", "--create", ref, commit,
|
||||
repo=f"{tree}/ostree/repo")
|
||||
|
||||
ostree("admin", "os-init", osname, sysroot=tree)
|
||||
|
||||
kargs = []
|
||||
|
|
@ -129,7 +138,7 @@ def main(tree, sources, options):
|
|||
os.makedirs(path, exist_ok=True) # FIXME: SELinux
|
||||
mounter.mount(path, path)
|
||||
|
||||
ostree("admin", "deploy", commit,
|
||||
ostree("admin", "deploy", ref,
|
||||
f"--karg=root={rootfs}",
|
||||
*kargs,
|
||||
sysroot=tree,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue