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