]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
util/bash-completion: Load scripts on demand
authorGary Lin <glin@suse.com>
Tue, 30 Jan 2024 06:41:10 +0000 (14:41 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 15 Feb 2024 15:51:36 +0000 (16:51 +0100)
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 a corresponding script for 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>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
15 files changed:
util/bash-completion.d/Makefile.am
util/bash-completion.d/grub-bios-setup.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-completion.bash.in
util/bash-completion.d/grub-editenv.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-install.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-mkconfig.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-mkfont.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-mkimage.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-mkpasswd-pbkdf2.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-mkrescue.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-probe.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-reboot.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-script-check.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-set-default.bash.in [new file with mode: 0644]
util/bash-completion.d/grub-sparc64-setup.bash.in [new file with mode: 0644]

index 136287cf1bfe21ac1fd10a136ed2c96a54c56295..33fff954647b388b6d5387692ed99299bbccf20f 100644 (file)
-
 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@
 
-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
-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 (file)
index 0000000..2d362b5
--- /dev/null
@@ -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
index 213ce1e57cfecec6115e5409533da3e9135df975..4c88ee901d97ced11486606c543d1217b1c0008a 100644 (file)
@@ -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 (file)
index 0000000..29b1333
--- /dev/null
@@ -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 (file)
index 0000000..a89fc61
--- /dev/null
@@ -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 (file)
index 0000000..862e0c5
--- /dev/null
@@ -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 (file)
index 0000000..17baccd
--- /dev/null
@@ -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 (file)
index 0000000..a383ed3
--- /dev/null
@@ -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 (file)
index 0000000..32b8fd6
--- /dev/null
@@ -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 (file)
index 0000000..5968ba0
--- /dev/null
@@ -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 (file)
index 0000000..08400f2
--- /dev/null
@@ -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 (file)
index 0000000..154aece
--- /dev/null
@@ -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 (file)
index 0000000..22d3768
--- /dev/null
@@ -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 (file)
index 0000000..14501b4
--- /dev/null
@@ -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 (file)
index 0000000..6123d7b
--- /dev/null
@@ -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