1 Star 0 Fork 103

GUI/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0213-10_linux.in-Don-t-update-BLS-files-that-aren-t-manag.patch 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 +08:00 . update to 2.04
From b72f41efc2b25d77e8530d0ed412acc03d6911d3 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Wed, 20 May 2020 12:23:27 +0200
Subject: [PATCH 213/220] 10_linux.in: Don't update BLS files that aren't
managed by GRUB scripts
The script is updating all BLS files present in the /boot/loader/entries
directory, but it should only update the BLS that belong to the machine.
Otherwise if a user is sharing the same boot partition between different
operating systems, the grub2-mkconfig tool will wrongly update BLS files
that were created by a different OS.
There are also cases where the BLS snippets are not managed by the GRUB
scripts at all, for example in OSTree based systems. So it's also wrong
to update the BLS snippets created by OSTree.
Resolves: rhbz#1837783
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub.d/10_linux.in | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 519e2d9..e61b6c9 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -138,16 +138,25 @@ blsdir="/boot/loader/entries"
get_sorted_bls()
{
+ if ! [ -d "${blsdir}" ] || ! [ -e /etc/machine-id ]; then
+ return
+ fi
+
+ read machine_id < /etc/machine-id
+ if [ -z "${machine_id}" ]; then
+ return
+ fi
+
local IFS=$'\n'
- files=($(for bls in ${blsdir}/*.conf; do
+ files=($(for bls in ${blsdir}/${machine_id}-*.conf; do
if ! [[ -e "${bls}" ]] ; then
continue
fi
bls="${bls%.conf}"
bls="${bls##*/}"
echo "${bls}"
- done | ${kernel_sort} | tac)) || :
+ done | ${kernel_sort} 2>/dev/null | tac)) || :
echo "${files[@]}"
}
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/GuEe-GUI/grub2.git
git@gitee.com:GuEe-GUI/grub2.git
GuEe-GUI
grub2
grub2
master

搜索帮助