From 9d79d5fcc3e91244746e986f7df5ecedde1b8e94 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Tue, 14 Apr 2020 21:29:53 +0200 Subject: [PATCH] stages/grub2: default to disabling `legacy` support For the sake of backwards compatibility, legacy support was enabled by default. Flip this around, so that leaving the parameter out means disabling it. This is more intuitive, and will pave the way for dropping support for the value being a bool in the future. `osbuild-composer` always passes the argumnet explicitly, though still always as a boolean. Signed-off-by: Tom Gundersen --- samples/base-qcow2.json | 3 ++- samples/base-rawfs.json | 3 ++- samples/base-rpm-qcow2.json | 3 ++- samples/cloud-base.json | 3 ++- samples/f30-aarch64.json | 1 - samples/f30-base-uefi.json | 3 ++- stages/org.osbuild.grub2 | 12 ++++++------ test/pipelines/f30-boot.json | 3 ++- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/samples/base-qcow2.json b/samples/base-qcow2.json index 78f07406..27aeeec6 100644 --- a/samples/base-qcow2.json +++ b/samples/base-qcow2.json @@ -50,7 +50,8 @@ "name": "org.osbuild.grub2", "options": { "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", - "kernel_opts": "ro biosdevname=0 net.ifnames=0" + "kernel_opts": "ro biosdevname=0 net.ifnames=0", + "legacy": "i386-pc" } }, { diff --git a/samples/base-rawfs.json b/samples/base-rawfs.json index 7a253c66..58940289 100644 --- a/samples/base-rawfs.json +++ b/samples/base-rawfs.json @@ -51,7 +51,8 @@ "name": "org.osbuild.grub2", "options": { "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", - "kernel_opts": "ro biosdevname=0 net.ifnames=0" + "kernel_opts": "ro biosdevname=0 net.ifnames=0", + "legacy": "i386-pc" } }, { diff --git a/samples/base-rpm-qcow2.json b/samples/base-rpm-qcow2.json index 882b9a0d..0a471296 100644 --- a/samples/base-rpm-qcow2.json +++ b/samples/base-rpm-qcow2.json @@ -924,7 +924,8 @@ "name": "org.osbuild.grub2", "options": { "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", - "kernel_opts": "ro biosdevname=0 net.ifnames=0" + "kernel_opts": "ro biosdevname=0 net.ifnames=0", + "legacy": "i386-pc" } }, { diff --git a/samples/cloud-base.json b/samples/cloud-base.json index 1002699d..fe9ef18b 100644 --- a/samples/cloud-base.json +++ b/samples/cloud-base.json @@ -53,7 +53,8 @@ "name": "org.osbuild.grub2", "options": { "root_fs_uuid": "ea711a29-e460-4879-9d70-9da99ae021f9", - "kernel_opts": "ro biosdevname=0 net.ifnames=0" + "kernel_opts": "ro biosdevname=0 net.ifnames=0", + "legacy": "i386-pc" } }, { diff --git a/samples/f30-aarch64.json b/samples/f30-aarch64.json index 8ed94ffb..f938a41d 100644 --- a/samples/f30-aarch64.json +++ b/samples/f30-aarch64.json @@ -74,7 +74,6 @@ "options": { "root_fs_uuid": "7acfe2cc-4134-482a-a9d4-4979a5a87569", "kernel_opts": "ro biosdevname=0 net.ifnames=0 console=ttyS0 console=tty1", - "legacy": false, "uefi": { "vendor": "fedora" } diff --git a/samples/f30-base-uefi.json b/samples/f30-base-uefi.json index dc7453b1..e0925a52 100644 --- a/samples/f30-base-uefi.json +++ b/samples/f30-base-uefi.json @@ -78,7 +78,8 @@ "kernel_opts": "ro biosdevname=0 net.ifnames=0 console=ttyS0 console=tty1", "uefi": { "vendor": "fedora" - } + }, + "legacy": "i386-pc" } }, { diff --git a/stages/org.osbuild.grub2 b/stages/org.osbuild.grub2 index 0dc811da..c69dca0a 100755 --- a/stages/org.osbuild.grub2 +++ b/stages/org.osbuild.grub2 @@ -19,9 +19,9 @@ behavior in Fedora 30 and later. This stage will overwrite `/etc/default/grub`, `/boot/grub2/grubenv`, and `/boot/grub2/grub.cfg`. (Leading directories will be created if not present.) -If Legacy boot support is requested (the default, or explicitly via `legacy`) -this stage will also overwrite `/boot/grub2/grub.cfg` and will copy the -GRUB2 files from the buildhost into the target tree: +If Legacy boot support is requested via `legacy` this stage will also +overwrite `/boot/grub2/grub.cfg` and will copy the GRUB2 files from the +buildhost into the target tree: * `/usr/share/grub/unicode.pf2` -> `/boot/grub2/fonts/` * `/usr/lib/grub/$platform/*.{mod,lst}` -> `/boot/grub2/$platform/` * NOTE: skips `fdt.lst`, which is an empty file @@ -67,8 +67,8 @@ STAGE_OPTS = """ "legacy": { "description": "Include legacy boot support", "oneOf": [ - {"type": "boolean", "default": true}, - {"type": "string", "default": "i386-pc"} + {"type": "boolean", "default": false}, + {"type": "string"} ] }, "uefi": { @@ -135,7 +135,7 @@ def main(tree, options): root_fs_uuid = options["root_fs_uuid"] boot_fs_uuid = options.get("boot_fs_uuid", None) kernel_opts = options.get("kernel_opts", "") - legacy = options.get("legacy", True) + legacy = options.get("legacy", None) uefi = options.get("uefi", None) # legacy boolean means the diff --git a/test/pipelines/f30-boot.json b/test/pipelines/f30-boot.json index f246c8eb..b0826eb8 100644 --- a/test/pipelines/f30-boot.json +++ b/test/pipelines/f30-boot.json @@ -924,7 +924,8 @@ "name": "org.osbuild.grub2", "options": { "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", - "kernel_opts": "ro biosdevname=0 net.ifnames=0" + "kernel_opts": "ro biosdevname=0 net.ifnames=0", + "legacy": "i386-pc" } }, {