From 5854ceea4263e4afb652d21bdba72fa79a9304a6 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 24 Aug 2019 23:20:02 +0200 Subject: [PATCH] stages/grub2: make booting in ro/rw mode configurable Move the decision whether the root fs should be mounted ro or rw into the pipeline configuration. Update the pipelines accordingly. Signed-off-by: Tom Gundersen --- samples/base-qcow2.json | 21 ++++++++++++++++++--- stages/org.osbuild.grub2 | 2 +- test/pipelines/web-server.json | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/samples/base-qcow2.json b/samples/base-qcow2.json index 15394156..f2352386 100644 --- a/samples/base-qcow2.json +++ b/samples/base-qcow2.json @@ -33,15 +33,30 @@ } }, { - "name": "org.osbuild.selinux", + "name": "org.osbuild.fstab", "options": { - "file_contexts": "etc/selinux/targeted/contexts/files/file_contexts" + "filesystems": [ + { + "uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", + "vfs_type": "ext4", + "path": "/", + "freq": "1", + "passno": "1" + } + ] } }, { "name": "org.osbuild.grub2", "options": { - "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac" + "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", + "kernel_opts": "ro biosdevname=0 net.ifnames=0 console=ttyS0,115200" + } + }, + { + "name": "org.osbuild.selinux", + "options": { + "file_contexts": "etc/selinux/targeted/contexts/files/file_contexts" } }, { diff --git a/stages/org.osbuild.grub2 b/stages/org.osbuild.grub2 index 9faa75e4..54da098d 100755 --- a/stages/org.osbuild.grub2 +++ b/stages/org.osbuild.grub2 @@ -20,7 +20,7 @@ def main(tree, options): env.write("# GRUB Environment Block\n" f"GRUB2_ROOT_FS_UUID={root_fs_uuid}\n" f"GRUB2_BOOT_FS_UUID={root_fs_uuid}\n" - f"kernelopts=root=UUID={root_fs_uuid} rw {kernel_opts}\n") + f"kernelopts=root=UUID={root_fs_uuid} {kernel_opts}\n") with open(f"{tree}/boot/grub2/grub.cfg", "w") as cfg: cfg.write("set timeout=0\n" "load_env\n" diff --git a/test/pipelines/web-server.json b/test/pipelines/web-server.json index c2fca0ba..f7d5c9cc 100644 --- a/test/pipelines/web-server.json +++ b/test/pipelines/web-server.json @@ -46,7 +46,8 @@ { "name": "org.osbuild.grub2", "options": { - "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac" + "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", + "kernel_opts": "rw" } } ],