8 Star 0 Fork 48

src-anolis-os/grub2

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0561-switch-to-blscfg-don-t-assume-newline-at-end-of-cfg.patch 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
小龙 提交于 2023-01-10 16:28 . update to grub2-2.02-142.el8_7.1
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Tue, 18 Oct 2022 14:15:28 -0400
Subject: [PATCH] switch-to-blscfg: don't assume newline at end of cfg
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
util/grub-switch-to-blscfg.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index eeea130770..5a97954c39 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -277,7 +277,9 @@ if grep '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" \
fi
GENERATE=1
elif ! grep -q '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" ; then
- if ! echo 'GRUB_ENABLE_BLSCFG=true' >> "${etcdefaultgrub}" ; then
+ # prepend in case admins have been bad at newlines
+ sed -i '1iGRUB_ENABLE_BLSCFG=true' "${etcdefaultgrub}"
+ if ! grep -q '^GRUB_ENABLE_BLSCFG=true' "${etcdefaultgrub}" ; then
gettext_printf "Updating %s failed\n" "${etcdefaultgrub}"
exit 1
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/grub2.git
git@gitee.com:src-anolis-os/grub2.git
src-anolis-os
grub2
grub2
a8

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385