From dfd044a512f396d38300a6329c7ade09dc438402 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Thu, 14 May 2020 12:55:21 +0200 Subject: [PATCH] stages/ostree: 'rootfs' option is not required Fedora CoreOS[1] uses a dracut module[2] together with a systemd generator[3] to mount the file system, including the root one. Thus neither '/etc/fstab' nor a `root=` kernel command line option is needed. Support that use case by making the 'rootfs' option optional. [1] https://github.com/coreos/fedora-coreos-config/tree/testing-devel/ [2] overlay.d/05core/usr/lib/dracut/modules.d/40ignition-ostree [3] overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator --- stages/org.osbuild.ostree | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/stages/org.osbuild.ostree b/stages/org.osbuild.ostree index 59d43c32..5171c423 100755 --- a/stages/org.osbuild.ostree +++ b/stages/org.osbuild.ostree @@ -32,7 +32,7 @@ from osbuild.util import selinux SCHEMA = """ -"required": ["commit", "osname", "rootfs"], +"required": ["commit", "osname"], "properties": { "commit": { "description": "checksum of the OSTree commit", @@ -219,10 +219,9 @@ def populate_var(sysroot): # pylint: disable=too-many-statements def main(tree, sources, options): - commit = options["commit"] osname = options["osname"] - rootfs = options["rootfs"] + rootfs = options.get("rootfs") mounts = options.get("mounts", []) kopts = options.get("kernel_opts", []) ref = options.get("ref", commit) @@ -249,6 +248,11 @@ def main(tree, sources, options): stateroot = f"{tree}/ostree/deploy/{osname}" kargs = [] + + if rootfs: + rootfs_id = make_fs_identifier(rootfs) + kargs += [f"--karg=root={rootfs_id}"] + for opt in kopts: kargs += [f"--karg-append={opt}"] @@ -260,9 +264,8 @@ def main(tree, sources, options): os.chmod(path, mount.get("mode", 0o755)) mounter.mount(path, path) - rootfs_id = make_fs_identifier(rootfs) + ostree("admin", "deploy", ref, - f"--karg=root={rootfs_id}", *kargs, sysroot=tree, os=osname)