Accepting request 1154596 from home:gary_lin:branches:Base:System

- Update grub2-change-bash-completion-dir.patch to support bash
  completion correctly (bsc#1218875)
- Drop grub2-bash-completion-2.12.patch since the have() function
  is not used in those scripts anymore

OBS-URL: https://build.opensuse.org/request/show/1154596
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=492
This commit is contained in:
Michael Chang 2024-03-05 05:36:14 +00:00 committed by Git OBS Bridge
parent 9317e49c7a
commit cd4c92fe1d
4 changed files with 860 additions and 152 deletions

View File

@ -1,145 +0,0 @@
From: Werner Fink <werner@suse.de>
Date: Thu, 29 Feb 2024 10:07:58 +000
Subject: 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
---
util/bash-completion.d/grub-completion.bash.in | 38 ++++++++++++++++---------
1 file changed, 25 insertions(+), 13 deletions(-)
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in 2024-02-29 10:04:52.197876569 +0000
@@ -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}

View File

@ -1,13 +1,859 @@
From 9c033a0d4c8ec3e845e0b426dcacb369342beff4 Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Mon, 29 Jan 2024 14:30:24 +0800
Subject: [PATCH] util/bash-completion: Load scripts on demand
There are two system directories for bash-completion scripts. One is
/usr/share/bash-completion/completions and the other is
/etc/bash_completion.d/. The 'etc' scripts are loaded in advance and
for backward compatibility while the 'usr' scripts are loaded on demand.
To load scripts on demand, it requires the corresponding script to
every command, so the main bash-completion script is split into several
subscripts for different grub commands. To share the code, the real
completion functions are still implemented in 'grub', and each
subscript sources 'grub' and invokes the corresponding function.
Signed-off-by: Gary Lin <glin@suse.com>
---
util/bash-completion.d/Makefile.am | 114 +++++++++++++++++-
.../bash-completion.d/grub-bios-setup.bash.in | 30 +++++
.../bash-completion.d/grub-completion.bash.in | 89 ++------------
util/bash-completion.d/grub-editenv.bash.in | 30 +++++
util/bash-completion.d/grub-install.bash.in | 30 +++++
util/bash-completion.d/grub-mkconfig.bash.in | 30 +++++
util/bash-completion.d/grub-mkfont.bash.in | 30 +++++
util/bash-completion.d/grub-mkimage.bash.in | 30 +++++
.../grub-mkpasswd-pbkdf2.bash.in | 30 +++++
util/bash-completion.d/grub-mkrescue.bash.in | 30 +++++
util/bash-completion.d/grub-probe.bash.in | 30 +++++
util/bash-completion.d/grub-reboot.bash.in | 30 +++++
.../grub-script-check.bash.in | 30 +++++
.../grub-set-default.bash.in | 30 +++++
.../grub-sparc64-setup.bash.in | 30 +++++
15 files changed, 510 insertions(+), 83 deletions(-)
create mode 100644 util/bash-completion.d/grub-bios-setup.bash.in
create mode 100644 util/bash-completion.d/grub-editenv.bash.in
create mode 100644 util/bash-completion.d/grub-install.bash.in
create mode 100644 util/bash-completion.d/grub-mkconfig.bash.in
create mode 100644 util/bash-completion.d/grub-mkfont.bash.in
create mode 100644 util/bash-completion.d/grub-mkimage.bash.in
create mode 100644 util/bash-completion.d/grub-mkpasswd-pbkdf2.bash.in
create mode 100644 util/bash-completion.d/grub-mkrescue.bash.in
create mode 100644 util/bash-completion.d/grub-probe.bash.in
create mode 100644 util/bash-completion.d/grub-reboot.bash.in
create mode 100644 util/bash-completion.d/grub-script-check.bash.in
create mode 100644 util/bash-completion.d/grub-set-default.bash.in
create mode 100644 util/bash-completion.d/grub-sparc64-setup.bash.in
diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am
index 136287c..2123a3c 100644
index 136287cf1..33fff9546 100644
--- a/util/bash-completion.d/Makefile.am
+++ b/util/bash-completion.d/Makefile.am
@@ -6,7 +6,7 @@ EXTRA_DIST = $(bash_completion_source)
@@ -1,13 +1,117 @@
-
bash_completion_source = grub-completion.bash.in
bash_completion_script = grub
+grub_bios_setup_source = grub-bios-setup.bash.in
+grub_bios_setup_script = @grub_bios_setup@
+grub_editenv_source = grub-editenv.bash.in
+grub_editenv_script = @grub_editenv@
+grub_install_source = grub-install.bash.in
+grub_install_script = @grub_install@
+grub_mkconfig_source = grub-mkconfig.bash.in
+grub_mkconfig_script = @grub_mkconfig@
+grub_mkfont_source = grub-mkfont.bash.in
+grub_mkfont_script = @grub_mkfont@
+grub_mkimage_source = grub-mkimage.bash.in
+grub_mkimage_script = @grub_mkimage@
+grub_mkpasswd_pbkdf2_source = grub-mkpasswd-pbkdf2.bash.in
+grub_mkpasswd_pbkdf2_script = @grub_mkpasswd_pbkdf2@
+grub_mkrescue_source = grub-mkrescue.bash.in
+grub_mkrescue_script = @grub_mkrescue@
+grub_probe_source = grub-probe.bash.in
+grub_probe_script = @grub_probe@
+grub_reboot_source = grub-reboot.bash.in
+grub_reboot_script = @grub_reboot@
+grub_script_check_source = grub-script-check.bash.in
+grub_script_check_script = @grub_script_check@
+grub_set_default_source = grub-set-default.bash.in
+grub_set_default_script = @grub_set_default@
+grub_sparc64_setup_source = grub-sparc64-setup.bash.in
+grub_sparc64_setup_script = @grub_sparc64_setup@
CLEANFILES = $(bash_completion_script) config.log
-EXTRA_DIST = $(bash_completion_source)
+EXTRA_DIST = $(bash_completion_source) \
+ $(grub_bios_setup_source) \
+ $(grub_editenv_source) \
+ $(grub_install_source) \
+ $(grub_mkconfig_source) \
+ $(grub_mkfont_source) \
+ $(grub_mkimage_source) \
+ $(grub_mkpasswd_pbkdf2_source) \
+ $(grub_mkrescue_source) \
+ $(grub_probe_source) \
+ $(grub_reboot_source) \
+ $(grub_script_check_source) \
+ $(grub_set_default_source) \
+ $(grub_sparc64_setup_source)
-CLEANFILES = $(bash_completion_script) config.log
+CLEANFILES = $(bash_completion_script) \
+ $(grub_bios_setup_script) \
+ $(grub_editenv_script) \
+ $(grub_install_script) \
+ $(grub_mkconfig_script) \
+ $(grub_mkfont_script) \
+ $(grub_mkimage_script) \
+ $(grub_mkpasswd_pbkdf2_script) \
+ $(grub_mkrescure_script) \
+ $(grub_probe_script) \
+ $(grub_reboot_script) \
+ $(grub_script_check_script) \
+ $(grub_set_default_script) \
+ $(grub_sparc64_setup_script) \
+ config.log
-bashcompletiondir = $(sysconfdir)/bash_completion.d
+bashcompletiondir = $(datadir)/bash-completion/completions
bashcompletion_DATA = $(bash_completion_script)
-bashcompletion_DATA = $(bash_completion_script)
+bashcompletiondir = $(datarootdir)/bash-completion/completions
+bashcompletion_DATA = $(bash_completion_script) \
+ $(grub_bios_setup_script) \
+ $(grub_editenv_script) \
+ $(grub_install_script) \
+ $(grub_mkconfig_script) \
+ $(grub_mkfont_script) \
+ $(grub_mkimage_script) \
+ $(grub_mkpasswd_pbkdf2_script) \
+ $(grub_mkrescure_script) \
+ $(grub_probe_script) \
+ $(grub_reboot_script) \
+ $(grub_script_check_script) \
+ $(grub_set_default_script) \
+ $(grub_sparc64_setup_script)
$(bash_completion_script): $(bash_completion_source) $(top_builddir)/config.status
$(top_builddir)/config.status --file=$@:$<
+
+$(grub_bios_setup_script): $(grub_bios_setup_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_editenv_script): $(grub_editenv_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_install_script): $(grub_install_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_mkconfig_script): $(grub_mkconfig_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_mkfont_script): $(grub_mkfont_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_mkimage_script): $(grub_mkimage_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_mkpasswd_pbkdf2_script): $(grub_mkpasswd_pbkdf2_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_mkrescue_script): $(grub_mkrescue_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_probe_script): $(grub_probe_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_reboot_script): $(grub_reboot_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_script_check_script): $(grub_script_check_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_set_default_script): $(grub_set_default_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+$(grub_sparc64_setup_script): $(grub_sparc64_setup_source) $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
diff --git a/util/bash-completion.d/grub-bios-setup.bash.in b/util/bash-completion.d/grub-bios-setup.bash.in
new file mode 100644
index 000000000..2d362b5e2
--- /dev/null
+++ b/util/bash-completion.d/grub-bios-setup.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-bios-setup@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_bios_setup () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_setup
+}
+complete -F _grub_bios_setup -o filenames @grub_bios_setup@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 213ce1e57..4c88ee901 100644
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in
@@ -150,7 +150,7 @@ __grub_list_modules () {
#
# grub-set-default & grub-reboot
#
-_grub_set_entry () {
+__grub_set_entry () {
local cur prev split=false
COMPREPLY=()
@@ -176,21 +176,10 @@ _grub_set_entry () {
fi
}
-__grub_set_default_program="@grub_set_default@"
-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} && \
- complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
-unset __grub_reboot_program
-
-
#
# grub-editenv
#
-_grub_editenv () {
+__grub_editenv () {
local cur prev
COMPREPLY=()
@@ -208,16 +197,10 @@ _grub_editenv () {
create list set unset"
}
-__grub_editenv_program="@grub_editenv@"
-have ${__grub_editenv_program} && \
- complete -F _grub_editenv -o filenames ${__grub_editenv_program}
-unset __grub_editenv_program
-
-
#
# grub-mkconfig
#
-_grub_mkconfig () {
+__grub_mkconfig () {
local cur prev
COMPREPLY=()
@@ -229,16 +212,11 @@ _grub_mkconfig () {
_filedir
fi
}
-__grub_mkconfig_program="@grub_mkconfig@"
-have ${__grub_mkconfig_program} && \
- complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
-unset __grub_mkconfig_program
-
#
# grub-setup
#
-_grub_setup () {
+__grub_setup () {
local cur prev split=false
COMPREPLY=()
@@ -264,21 +242,10 @@ _grub_setup () {
fi
}
-__grub_bios_setup_program="@grub_bios_setup@"
-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} && \
- complete -F _grub_setup -o filenames ${__grub_sparc64_setup_program}
-unset __grub_sparc64_setup_program
-
-
#
# grub-install
#
-_grub_install () {
+__grub_install () {
local cur prev last split=false
COMPREPLY=()
@@ -315,16 +282,11 @@ _grub_install () {
_filedir
fi
}
-__grub_install_program="@grub_install@"
-have ${__grub_install_program} && \
- complete -F _grub_install -o filenames ${__grub_install_program}
-unset __grub_install_program
-
#
# grub-mkfont
#
-_grub_mkfont () {
+__grub_mkfont () {
local cur
COMPREPLY=()
@@ -337,16 +299,11 @@ _grub_mkfont () {
_filedir
fi
}
-__grub_mkfont_program="@grub_mkfont@"
-have ${__grub_mkfont_program} && \
- complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
-unset __grub_mkfont_program
-
#
# grub-mkrescue
#
-_grub_mkrescue () {
+__grub_mkrescue () {
local cur prev last
COMPREPLY=()
@@ -368,16 +325,11 @@ _grub_mkrescue () {
_filedir
fi
}
-__grub_mkrescue_program="@grub_mkrescue@"
-have ${__grub_mkrescue_program} && \
- complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
-unset __grub_mkrescue_program
-
#
# grub-mkimage
#
-_grub_mkimage () {
+__grub_mkimage () {
local cur prev split=false
COMPREPLY=()
@@ -410,16 +362,11 @@ _grub_mkimage () {
_filedir
fi
}
-__grub_mkimage_program="@grub_mkimage@"
-have ${__grub_mkimage_program} && \
- complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
-unset __grub_mkimage_program
-
#
# grub-mkpasswd-pbkdf2
#
-_grub_mkpasswd_pbkdf2 () {
+__grub_mkpasswd_pbkdf2 () {
local cur
COMPREPLY=()
@@ -432,16 +379,11 @@ _grub_mkpasswd_pbkdf2 () {
_filedir
fi
}
-__grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
-have ${__grub_mkpasswd_pbkdf2_program} && \
- complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
-unset __grub_mkpasswd_pbkdf2_program
-
#
# grub-probe
#
-_grub_probe () {
+__grub_probe () {
local cur prev split=false
COMPREPLY=()
@@ -470,16 +412,11 @@ _grub_probe () {
_filedir
fi
}
-__grub_probe_program="@grub_probe@"
-have ${__grub_probe_program} && \
- complete -F _grub_probe -o filenames ${__grub_probe_program}
-unset __grub_probe_program
-
#
# grub-script-check
#
-_grub_script_check () {
+__grub_script_check () {
local cur
COMPREPLY=()
@@ -492,10 +429,6 @@ _grub_script_check () {
_filedir
fi
}
-__grub_script_check_program="@grub_script_check@"
-have ${__grub_script_check_program} && \
- complete -F _grub_script_check -o filenames ${__grub_script_check_program}
-
# Local variables:
# mode: shell-script
diff --git a/util/bash-completion.d/grub-editenv.bash.in b/util/bash-completion.d/grub-editenv.bash.in
new file mode 100644
index 000000000..29b1333ea
--- /dev/null
+++ b/util/bash-completion.d/grub-editenv.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-editenv@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_editenv () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_editenv
+}
+complete -F _grub_editenv -o filenames @grub_editenv@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-install.bash.in b/util/bash-completion.d/grub-install.bash.in
new file mode 100644
index 000000000..a89fc614a
--- /dev/null
+++ b/util/bash-completion.d/grub-install.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-install@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_install () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_install
+}
+complete -F _grub_install -o filenames @grub_install@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-mkconfig.bash.in b/util/bash-completion.d/grub-mkconfig.bash.in
new file mode 100644
index 000000000..862e0c58f
--- /dev/null
+++ b/util/bash-completion.d/grub-mkconfig.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-mkconfig@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_mkconfig () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_mkconfig
+}
+complete -F _grub_mkconfig -o filenames @grub_mkconfig@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-mkfont.bash.in b/util/bash-completion.d/grub-mkfont.bash.in
new file mode 100644
index 000000000..17baccdf5
--- /dev/null
+++ b/util/bash-completion.d/grub-mkfont.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-mkfont@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_mkfont () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_mkfont
+}
+complete -F _grub_mkfont -o filenames @grub_mkfont@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-mkimage.bash.in b/util/bash-completion.d/grub-mkimage.bash.in
new file mode 100644
index 000000000..a383ed3e9
--- /dev/null
+++ b/util/bash-completion.d/grub-mkimage.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-mkimage@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_mkimage () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_mkimage
+}
+complete -F _grub_mkimage -o filenames @grub_mkimage@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-mkpasswd-pbkdf2.bash.in b/util/bash-completion.d/grub-mkpasswd-pbkdf2.bash.in
new file mode 100644
index 000000000..32b8fd6eb
--- /dev/null
+++ b/util/bash-completion.d/grub-mkpasswd-pbkdf2.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-mkpasswd-pbkdf2@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_mkpasswd_pbkdf2 () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_mkpasswd_pbkdf2
+}
+complete -F _grub_mkpasswd_pbkdf2 -o filenames @grub_mkpasswd_pbkdf2@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-mkrescue.bash.in b/util/bash-completion.d/grub-mkrescue.bash.in
new file mode 100644
index 000000000..5968ba00e
--- /dev/null
+++ b/util/bash-completion.d/grub-mkrescue.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-mkresue@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_mkrescue () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_mkrescue
+}
+complete -F _grub_mkrescue -o filenames @grub_mkrescue@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-probe.bash.in b/util/bash-completion.d/grub-probe.bash.in
new file mode 100644
index 000000000..08400f2f1
--- /dev/null
+++ b/util/bash-completion.d/grub-probe.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-probe@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_probe () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_probe
+}
+complete -F _grub_probe -o filenames @grub_probe@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-reboot.bash.in b/util/bash-completion.d/grub-reboot.bash.in
new file mode 100644
index 000000000..154aecea9
--- /dev/null
+++ b/util/bash-completion.d/grub-reboot.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-reboot@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_reboot () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_set_entry
+}
+complete -F _grub_reboot -o filenames @grub_reboot@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-script-check.bash.in b/util/bash-completion.d/grub-script-check.bash.in
new file mode 100644
index 000000000..22d376832
--- /dev/null
+++ b/util/bash-completion.d/grub-script-check.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-script-check@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_script_check () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_script_check
+}
+complete -F _grub_script_check -o filenames @grub_script_check@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-set-default.bash.in b/util/bash-completion.d/grub-set-default.bash.in
new file mode 100644
index 000000000..14501b4fb
--- /dev/null
+++ b/util/bash-completion.d/grub-set-default.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-set-default@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_set_default () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_set_entry
+}
+complete -F _grub_set_default -o filenames @grub_set_default@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/util/bash-completion.d/grub-sparc64-setup.bash.in b/util/bash-completion.d/grub-sparc64-setup.bash.in
new file mode 100644
index 000000000..6123d7b7c
--- /dev/null
+++ b/util/bash-completion.d/grub-sparc64-setup.bash.in
@@ -0,0 +1,30 @@
+#
+# Bash completion for @grub-sparc64-setup@
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
+
+_grub_sparc64_setup () {
+ . @datarootdir@/bash-completion/completions/grub && __grub_setup
+}
+complete -F _grub_sparc64_setup -o filenames @grub_sparc64_setup@
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh
--
2.35.3

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Mar 4 08:57:36 UTC 2024 - Gary Ching-Pang Lin <glin@suse.com>
- Update grub2-change-bash-completion-dir.patch to support bash
completion correctly (bsc#1218875)
- Drop grub2-bash-completion-2.12.patch since the have() function
is not used in those scripts anymore
-------------------------------------------------------------------
Fri Mar 1 12:44:37 UTC 2024 - Giacomo Comes <gcomes.obs@gmail.com>

View File

@ -393,7 +393,6 @@ Patch199: 0001-squash-ieee1275-ofpath-enable-NVMeoF-logical-device-.patch
Patch200: 0001-ofdisk-enhance-boot-time-by-focusing-on-boot-disk-re.patch
Patch201: 0002-ofdisk-add-early_log-support.patch
Patch202: 0001-disk-Optimize-disk-iteration-by-moving-memdisk-to-th.patch
Patch203: grub2-bash-completion-2.12.patch
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140
@ -1274,7 +1273,7 @@ fi
%endif
%dir /boot/%{name}
%ghost %attr(600, root, root) /boot/%{name}/grub.cfg
%{_datadir}/bash-completion/completions/grub
%{_datadir}/bash-completion/completions/grub*
%config(noreplace) %{_sysconfdir}/default/grub
%dir %{_sysconfdir}/grub.d
%{_sysconfdir}/grub.d/README