1 Star 0 Fork 83

dingwei / grub2

forked from src-openEuler / grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0203-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 . update to 2.04
From 06b00bced8807fe8c16f2abdfad956f59e053ca8 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Thu, 16 Apr 2020 18:53:03 +0200
Subject: [PATCH 203/220] grub-switch-to-blscfg: Use install to copy GRUB
binary, modules and config
By default the cp command truncates the destination before copying from the
source, so if interrupted it can lead to a file that's half written.
This behavior can be modified using the --remove-destination option, but is
usually a better choice to use the install tool for this. So let's do that.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub-switch-to-blscfg.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index 4bbed8e..3333a62 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -273,7 +273,7 @@ copy_bls() {
if test -f /run/ostree-booted && test -d /sys/firmware/efi/efivars && \
! ${grub_editenv} - list | grep -q blsdir; then
grub_binary="$(find /usr/lib/ostree-boot/efi/EFI/${EFIDIR}/ -name grub*.efi)"
- cp ${grub_binary} ${grubdir} || exit 1
+ install -m 700 ${grub_binary} ${grubdir} || exit 1
# Create a hidden file to indicate that grub2 now has BLS support.
touch /boot/grub2/.grub2-blscfg-supported
fi
@@ -307,13 +307,13 @@ if [ "${GENERATE}" -eq 1 ] ; then
if [ -n "${mod_dir}" ]; then
for mod in blscfg increment; do
- cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1
+ install -m 700 ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1
done
fi
cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}"
if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then
- cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}"
+ install -m 700 "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}"
sed -i"${backupsuffix}" \
-e 's,^GRUB_ENABLE_BLSCFG=.*,GRUB_ENABLE_BLSCFG=false,' \
"${etcdefaultgrub}"
--
1.8.3.1
1
https://gitee.com/dingwei_chinamobile/grub2.git
git@gitee.com:dingwei_chinamobile/grub2.git
dingwei_chinamobile
grub2
grub2
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891