代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/grub2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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 9682e97b7..01e66e5fc 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 3cc7803c6..8a3379578 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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。