|
|
d9d99f |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
d9d99f |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
d9d99f |
Date: Mon, 10 Dec 2018 13:11:58 +0100
|
|
|
d9d99f |
Subject: [PATCH] Make grub2-mkconfig to honour GRUB_CMDLINE_LINUX in
|
|
|
d9d99f |
/etc/default/grub
|
|
|
d9d99f |
|
|
|
d9d99f |
The kernelopts grub environment variable is set with the GRUB_CMDLINE_LINUX
|
|
|
d9d99f |
value only if wasn't set before. This is because the kernel cmdline params
|
|
|
d9d99f |
of the entries are not in the grub.cfg anymore so grub2-mkconfig shouldn't
|
|
|
d9d99f |
have side effects on neither the entries nor their kernel cmdline params.
|
|
|
d9d99f |
|
|
|
d9d99f |
But there's a lot of documentation pointing at modifying GRUB_CMDLINE_LINUX
|
|
|
d9d99f |
to change the kernel cmdline params and users have built a muscle memory on
|
|
|
d9d99f |
it, so the BLS support should be compatible.
|
|
|
d9d99f |
|
|
|
d9d99f |
Make the grub2-mkconfig script update the $kernelopts environment variable
|
|
|
d9d99f |
unless the --no-grubenv-update option is used.
|
|
|
d9d99f |
|
|
|
d9d99f |
Resolves: rhbz#1637875
|
|
|
d9d99f |
|
|
|
d9d99f |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
d9d99f |
---
|
|
|
d9d99f |
util/grub-mkconfig.8 | 4 ++++
|
|
|
d9d99f |
util/grub-mkconfig.in | 6 ++++++
|
|
|
d9d99f |
util/grub.d/10_linux.in | 2 +-
|
|
|
d9d99f |
util/grub.d/10_linux_bls.in | 2 +-
|
|
|
d9d99f |
4 files changed, 12 insertions(+), 2 deletions(-)
|
|
|
d9d99f |
|
|
|
d9d99f |
diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8
|
|
|
b71686 |
index a2d1f577b..434fa4ded 100644
|
|
|
d9d99f |
--- a/util/grub-mkconfig.8
|
|
|
d9d99f |
+++ b/util/grub-mkconfig.8
|
|
|
d9d99f |
@@ -13,5 +13,9 @@
|
|
|
d9d99f |
\fB--output\fR=\fIFILE\fR
|
|
|
d9d99f |
Write generated output to \fIFILE\fR.
|
|
|
d9d99f |
|
|
|
d9d99f |
+.TP
|
|
|
d9d99f |
+\fB--no-grubenv-update\fR
|
|
|
d9d99f |
+Do not update variables in the grubenv file.
|
|
|
d9d99f |
+
|
|
|
d9d99f |
.SH SEE ALSO
|
|
|
d9d99f |
.BR "info grub"
|
|
|
d9d99f |
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
|
|
b71686 |
index c20171919..5e643e169 100644
|
|
|
d9d99f |
--- a/util/grub-mkconfig.in
|
|
|
d9d99f |
+++ b/util/grub-mkconfig.in
|
|
|
d9d99f |
@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
|
|
|
d9d99f |
export TEXTDOMAIN=@PACKAGE@
|
|
|
d9d99f |
export TEXTDOMAINDIR="@localedir@"
|
|
|
d9d99f |
|
|
|
d9d99f |
+export GRUB_GRUBENV_UPDATE="yes"
|
|
|
d9d99f |
+
|
|
|
d9d99f |
. "${pkgdatadir}/grub-mkconfig_lib"
|
|
|
d9d99f |
|
|
|
d9d99f |
# Usage: usage
|
|
|
d9d99f |
@@ -59,6 +61,7 @@ usage () {
|
|
|
d9d99f |
gettext "Generate a grub config file"; echo
|
|
|
d9d99f |
echo
|
|
|
d9d99f |
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
|
|
|
d9d99f |
+ print_option_help "--no-grubenv-update" "$(gettext "do not update variables in the grubenv file")"
|
|
|
d9d99f |
print_option_help "-h, --help" "$(gettext "print this message and exit")"
|
|
|
d9d99f |
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
|
|
|
d9d99f |
echo
|
|
|
d9d99f |
@@ -94,6 +97,9 @@ do
|
|
|
d9d99f |
--output=*)
|
|
|
d9d99f |
grub_cfg=`echo "$option" | sed 's/--output=//'`
|
|
|
d9d99f |
;;
|
|
|
d9d99f |
+ --no-grubenv-update)
|
|
|
d9d99f |
+ GRUB_GRUBENV_UPDATE="no"
|
|
|
d9d99f |
+ ;;
|
|
|
d9d99f |
-*)
|
|
|
d9d99f |
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
|
|
|
d9d99f |
usage
|
|
|
d9d99f |
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
|
|
b71686 |
index b54d2774a..da2992ac9 100644
|
|
|
d9d99f |
--- a/util/grub.d/10_linux.in
|
|
|
d9d99f |
+++ b/util/grub.d/10_linux.in
|
|
|
d9d99f |
@@ -165,7 +165,7 @@ if [ -s \$prefix/grubenv ]; then
|
|
|
d9d99f |
fi
|
|
|
d9d99f |
EOF
|
|
|
d9d99f |
|
|
|
d9d99f |
- if ! grub2-editenv - list | grep -q kernelopts; then
|
|
|
d9d99f |
+ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
|
|
|
d9d99f |
${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
|
|
d9d99f |
fi
|
|
|
d9d99f |
|
|
|
d9d99f |
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
|
|
|
b71686 |
index 8cff4c58a..175bedd07 100644
|
|
|
d9d99f |
--- a/util/grub.d/10_linux_bls.in
|
|
|
d9d99f |
+++ b/util/grub.d/10_linux_bls.in
|
|
|
d9d99f |
@@ -225,7 +225,7 @@ linux_entry ()
|
|
|
d9d99f |
populate_header_warn
|
|
|
d9d99f |
populate_menu
|
|
|
d9d99f |
|
|
|
d9d99f |
- if ! grub2-editenv - list | grep -q kernelopts; then
|
|
|
d9d99f |
+ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
|
|
|
d9d99f |
${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
|
|
d9d99f |
fi
|
|
|
d9d99f |
|