1 Star 0 Fork 16

jackzhao166/grub2

forked from OpenCloudOS Stream/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0178-Make-bash-completion-work-with-version-2.12-and-befo.patch 4.51 KB
一键复制 编辑 原始数据 按行查看 历史
nilusyi 提交于 2024-04-07 16:45 . update patches
From 8616826f05c35c48f72ec89f1fe0c21ce6117d85 Mon Sep 17 00:00:00 2001
From: Werner Fink <werner@suse.de>
Date: Thu, 29 Feb 2024 10:07:58 +0800
Subject: [PATCH 178/272] Make bash completion work with version 2.12 and
before 2.11
Note that the shell function have() had become deprecated with 2.11
and had been removed from 2.12 which is now providing _comp_have_command()
resolves boo#1220626
---
.../bash-completion.d/grub-completion.bash.in | 38 ++++++++++++-------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 213ce1e57..76834bbfb 100644
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in
@@ -17,6 +17,18 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# bash completion for grub
+if test "$(type -t _comp_have_command)" = function
+then
+ _have() {
+ _comp_have_command $1
+ }
+elif test "$(type -t have)" = function
+then
+ _have() {
+ have $1
+ }
+fi
+
__grub_dir() {
local i c=1 boot_dir
@@ -177,12 +189,12 @@ _grub_set_entry () {
}
__grub_set_default_program="@grub_set_default@"
-have ${__grub_set_default_program} && \
+_have ${__grub_set_default_program} && \
complete -F _grub_set_entry -o filenames ${__grub_set_default_program}
unset __grub_set_default_program
__grub_reboot_program="@grub_reboot@"
-have ${__grub_reboot_program} && \
+_have ${__grub_reboot_program} && \
complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
unset __grub_reboot_program
@@ -209,7 +221,7 @@ _grub_editenv () {
}
__grub_editenv_program="@grub_editenv@"
-have ${__grub_editenv_program} && \
+_have ${__grub_editenv_program} && \
complete -F _grub_editenv -o filenames ${__grub_editenv_program}
unset __grub_editenv_program
@@ -230,7 +242,7 @@ _grub_mkconfig () {
fi
}
__grub_mkconfig_program="@grub_mkconfig@"
-have ${__grub_mkconfig_program} && \
+_have ${__grub_mkconfig_program} && \
complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
unset __grub_mkconfig_program
@@ -265,12 +277,12 @@ _grub_setup () {
}
__grub_bios_setup_program="@grub_bios_setup@"
-have ${__grub_bios_setup_program} && \
+_have ${__grub_bios_setup_program} && \
complete -F _grub_setup -o filenames ${__grub_bios_setup_program}
unset __grub_bios_setup_program
__grub_sparc64_setup_program="@grub_sparc64_setup@"
-have ${__grub_sparc64_setup_program} && \
+_have ${__grub_sparc64_setup_program} && \
complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program}
unset __grub_sparc64_setup_program
@@ -316,7 +328,7 @@ _grub_install () {
fi
}
__grub_install_program="@grub_install@"
-have ${__grub_install_program} && \
+_have ${__grub_install_program} && \
complete -F _grub_install -o filenames ${__grub_install_program}
unset __grub_install_program
@@ -338,7 +350,7 @@ _grub_mkfont () {
fi
}
__grub_mkfont_program="@grub_mkfont@"
-have ${__grub_mkfont_program} && \
+_have ${__grub_mkfont_program} && \
complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
unset __grub_mkfont_program
@@ -369,7 +381,7 @@ _grub_mkrescue () {
fi
}
__grub_mkrescue_program="@grub_mkrescue@"
-have ${__grub_mkrescue_program} && \
+_have ${__grub_mkrescue_program} && \
complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
unset __grub_mkrescue_program
@@ -411,7 +423,7 @@ _grub_mkimage () {
fi
}
__grub_mkimage_program="@grub_mkimage@"
-have ${__grub_mkimage_program} && \
+_have ${__grub_mkimage_program} && \
complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
unset __grub_mkimage_program
@@ -433,7 +445,7 @@ _grub_mkpasswd_pbkdf2 () {
fi
}
__grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
-have ${__grub_mkpasswd_pbkdf2_program} && \
+_have ${__grub_mkpasswd_pbkdf2_program} && \
complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
unset __grub_mkpasswd_pbkdf2_program
@@ -471,7 +483,7 @@ _grub_probe () {
fi
}
__grub_probe_program="@grub_probe@"
-have ${__grub_probe_program} && \
+_have ${__grub_probe_program} && \
complete -F _grub_probe -o filenames ${__grub_probe_program}
unset __grub_probe_program
@@ -493,7 +505,7 @@ _grub_script_check () {
fi
}
__grub_script_check_program="@grub_script_check@"
-have ${__grub_script_check_program} && \
+_have ${__grub_script_check_program} && \
complete -F _grub_script_check -o filenames ${__grub_script_check_program}
--
2.41.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jackzhao166/grub2.git
git@gitee.com:jackzhao166/grub2.git
jackzhao166
grub2
grub2
master

搜索帮助