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
This commit is contained in:
Christian Kellner 2020-05-14 12:55:21 +02:00 committed by David Rheinsberg
parent 58db898790
commit dfd044a512

View file

@ -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)