80 lines
2.5 KiB
Diff
80 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
Date: Fri, 5 Oct 2018 16:29:47 +0200
|
|
Subject: [PATCH] Only set kernelopts in grubenv if it wasn't set before
|
|
|
|
Users may want to use a different command line parameters, so if there's
|
|
a kernelopts var set in grubenv, grub2-mkconfig shouldn't reset it.
|
|
|
|
While being there, print a warning so users know that they shouldn't edit
|
|
the grub config file and instead edit the BootLoaderSpec config files.
|
|
|
|
Resolves: rhbz#1636466
|
|
|
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
---
|
|
util/grub.d/10_linux.in | 20 +++++++++++++++++++-
|
|
util/grub.d/10_linux_bls.in | 4 +++-
|
|
2 files changed, 22 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
|
index 9682e97b7f5..01e66e5fc74 100644
|
|
--- a/util/grub.d/10_linux.in
|
|
+++ b/util/grub.d/10_linux.in
|
|
@@ -82,6 +82,20 @@ case x"$GRUB_FS" in
|
|
;;
|
|
esac
|
|
|
|
+populate_header_warn()
|
|
+{
|
|
+cat <<EOF
|
|
+
|
|
+# This section was generated by a script. Do not modify the generated file - all changes
|
|
+# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files.
|
|
+#
|
|
+# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and
|
|
+# populates the boot menu. Please refer to the Boot Loader Specification documentation
|
|
+# for the files format: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/.
|
|
+
|
|
+EOF
|
|
+}
|
|
+
|
|
mktitle ()
|
|
{
|
|
local title_type
|
|
@@ -141,6 +155,8 @@ linux_entry ()
|
|
prepare_grub_to_access_device ${boot_device} boot
|
|
fi
|
|
|
|
+ populate_header_warn
|
|
+
|
|
cat << EOF
|
|
insmod blscfg
|
|
blscfg
|
|
@@ -150,7 +166,9 @@ fi
|
|
EOF
|
|
|
|
${grub_editenv} - set saved_entry=0
|
|
- ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
|
+ if ! grub2-editenv - list | grep -q kernelopts; then
|
|
+ ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
|
+ fi
|
|
|
|
exit 0
|
|
fi
|
|
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
|
|
index 3cc7803c6a1..8a3379578bd 100644
|
|
--- a/util/grub.d/10_linux_bls.in
|
|
+++ b/util/grub.d/10_linux_bls.in
|
|
@@ -201,7 +201,9 @@ linux_entry ()
|
|
populate_menu
|
|
|
|
${grub_editenv} - set saved_entry=0
|
|
- ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
|
+ if ! grub2-editenv - list | grep -q kernelopts; then
|
|
+ ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
|
+ fi
|
|
|
|
exit 0
|
|
fi
|