1 Star 0 Fork 50

山竹/grub2

forked from src-anolis-os/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0162-Fix-grub-switch-to-blscfg-boot-prefix-handling.patch 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:15 . update to grub2-2.02-120.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 9 Jul 2018 12:19:03 +0200
Subject: [PATCH] Fix grub-switch-to-blscfg boot prefix handling
Commit b3ac18e3265f ("grub-switch-to-blscfg.in: Better boot prefix checking")
simplified the boot prefix checking, but unfortunately introduced a couple of
regressions on the script. Fix them.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub-switch-to-blscfg.in | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index 2f37a1f74..40612e006 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -220,7 +220,8 @@ EOF
for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf"
- linux="$(grep '^linux[ \t]' "${bls_target}" | sed -e 's,^linux[ \t]+,,')"
+ linux="/vmlinuz-${kernelver}"
+ linux_path="/boot${linux}"
kernel_dir="/lib/modules/${kernelver}"
if [ ! -d "${kernel_dir}" ] ; then
@@ -230,8 +231,8 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
continue
fi
- linux_relpath="$("${grub_mkrelpath}" "${linux}")"
- bootprefix="${linux%%"${linux_relpath}"}"
+ linux_relpath="$("${grub_mkrelpath}" "${linux_path}")"
+ bootprefix="${linux_relpath%%"${linux}"}"
if [ -f "${kernel_dir}/bls.conf" ] ; then
cp -af "${kernel_dir}/bls.conf" "${bls_target}"
@@ -243,7 +244,8 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
fi
if [ -n "${bootprefix}" ]; then
- sed -i -e "s,\([ \t]\)${bootprefix},\1,g" "${bls_target}"
+ sed -i -e "s,^\(linux[^ \t]*[ \t]\+\).*,\1${bootprefix}${linux},g" "${bls_target}"
+ sed -i -e "/^initrd/ s,\([ \t]\+\)\([^ \t]\+\),\1${bootprefix}\2,g" "${bls_target}"
fi
if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then
@@ -258,7 +260,7 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
fi
done
-if [ -n "${bootprefix}" -a -f "/boot/vmlinuz-0-rescue-${MACHINE_ID}" ]; then
+if [ -f "/boot/vmlinuz-0-rescue-${MACHINE_ID}" ]; then
mkbls "0-rescue-${MACHINE_ID}" "0" "${bootprefix}" >"${blsdir}/${MACHINE_ID}-0-rescue.conf"
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangpingping000/grub2.git
git@gitee.com:wangpingping000/grub2.git
wangpingping000
grub2
grub2
a8

搜索帮助