加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0241-10_linux_bls-use-grub2-rpm-sort-instead-of-ls-vr-to-.patch 1.42 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: Tue, 16 Oct 2018 15:48:15 +0200
Subject: [PATCH] 10_linux_bls: use grub2-rpm-sort instead of ls -vr to sort
entries
Using ls -vr is wrong since it's not the same than the RPM sort algorithm.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub.d/10_linux_bls.in | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
index 8a3379578..1bc97f298 100644
--- a/util/grub.d/10_linux_bls.in
+++ b/util/grub.d/10_linux_bls.in
@@ -151,10 +151,22 @@ read_config()
populate_menu()
{
- entries_path="/boot/loader/entries"
+ blsdir="/boot/loader/entries"
+ local -a files
+ local IFS=$'\n'
gettext_printf "Generating boot entries from BLS files...\n" >&2
- for config in $(ls -v -r $entries_path/*.conf); do
- read_config ${config}
+
+ files=($(for bls in ${blsdir}/*.conf ; do
+ if ! [[ -e "${bls}" ]] ; then
+ continue
+ fi
+ bls="${bls%.conf}"
+ bls="${bls##*/}"
+ echo "${bls}"
+ done | ${kernel_sort} | tac)) || :
+
+ for bls in "${files[@]}" ; do
+ read_config "${blsdir}/${bls}.conf"
menu="${menu}menuentry '${title}' {\n"
menu="${menu}\t linux ${linux} ${options}\n"
if [ -n "${initrd}" ] ; then
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化