|
|
670361 |
From a797a566127f7469d744b2748f98d1fa5ea8d8f9 Mon Sep 17 00:00:00 2001
|
|
|
670361 |
From: Peter Jones <pjones@redhat.com>
|
|
|
670361 |
Date: Tue, 14 Jun 2016 10:20:14 -0400
|
|
|
670361 |
Subject: [PATCH 07/10] Add bash completion file.
|
|
|
670361 |
|
|
|
670361 |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
670361 |
---
|
|
|
670361 |
configure.ac | 17 +++++++++++++++++
|
|
|
670361 |
Makefile.am | 5 +++++
|
|
|
670361 |
data/mokutil | 37 +++++++++++++++++++++++++++++++++++++
|
|
|
670361 |
3 files changed, 59 insertions(+)
|
|
|
670361 |
create mode 100755 data/mokutil
|
|
|
670361 |
|
|
|
670361 |
diff --git a/configure.ac b/configure.ac
|
|
|
670361 |
index 69d412ac633..7b52a063df0 100644
|
|
|
670361 |
--- a/configure.ac
|
|
|
670361 |
+++ b/configure.ac
|
|
|
670361 |
@@ -86,6 +86,23 @@ AC_CHECK_FUNCS([memset])
|
|
|
670361 |
PKG_CHECK_MODULES(OPENSSL, [openssl >= 0.9.8])
|
|
|
670361 |
PKG_CHECK_MODULES(EFIVAR, [efivar >= 0.12])
|
|
|
670361 |
|
|
|
670361 |
+AC_ARG_WITH([bash-completion-dir],
|
|
|
670361 |
+ AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
|
|
|
670361 |
+ [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
|
|
|
670361 |
+ [],
|
|
|
670361 |
+ [with_bash_completion_dir=yes])
|
|
|
670361 |
+
|
|
|
670361 |
+if test "x$with_bash_completion_dir" = "xyes"; then
|
|
|
670361 |
+ PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
|
|
|
670361 |
+ [BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"],
|
|
|
670361 |
+ [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"])
|
|
|
670361 |
+else
|
|
|
670361 |
+ BASH_COMPLETION_DIR="$with_bash_completion_dir"
|
|
|
670361 |
+fi
|
|
|
670361 |
+
|
|
|
670361 |
+AC_SUBST([BASH_COMPLETION_DIR])
|
|
|
670361 |
+AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
|
|
|
670361 |
+
|
|
|
670361 |
AC_CONFIG_FILES([Makefile
|
|
|
670361 |
src/Makefile
|
|
|
670361 |
man/Makefile])
|
|
|
670361 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
670361 |
index 9f0d4192515..c17cc4a86d8 100644
|
|
|
670361 |
--- a/Makefile.am
|
|
|
670361 |
+++ b/Makefile.am
|
|
|
670361 |
@@ -1 +1,6 @@
|
|
|
670361 |
SUBDIRS = src man
|
|
|
670361 |
+
|
|
|
670361 |
+if ENABLE_BASH_COMPLETION
|
|
|
670361 |
+ bashcompletiondir = $(BASH_COMPLETION_DIR)
|
|
|
670361 |
+ dist_bashcompletion_DATA = data/mokutil
|
|
|
670361 |
+endif
|
|
|
670361 |
diff --git a/data/mokutil b/data/mokutil
|
|
|
670361 |
new file mode 100755
|
|
|
670361 |
index 00000000000..800b039e7f4
|
|
|
670361 |
--- /dev/null
|
|
|
670361 |
+++ b/data/mokutil
|
|
|
670361 |
@@ -0,0 +1,37 @@
|
|
|
670361 |
+#!/bin/bash
|
|
|
670361 |
+
|
|
|
670361 |
+_mokutil()
|
|
|
670361 |
+{
|
|
|
670361 |
+ local cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
670361 |
+
|
|
|
670361 |
+ if [[ "$cur" == -* ]]; then
|
|
|
670361 |
+ #COMPREPLY=( $( compgen -W "--help --list-enrolled --list-new --list-delete --import --delete --revoke-import --revoke-delete --export --password --clear-password --disable-validation --enable-validation --sb-state --test-key --reset --generate-hash --hash-file --root-pw --simple-hash" -- $cur ) )
|
|
|
670361 |
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) -h -l -N -D -i -d -x -p -c -t -f -g -P -s -X' -- "$cur" ) )
|
|
|
670361 |
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
|
|
|
670361 |
+ return 0
|
|
|
670361 |
+ fi
|
|
|
670361 |
+
|
|
|
670361 |
+ case "${COMP_WORDS[COMP_CWORD-1]}" in
|
|
|
670361 |
+ --import|-i|--delete|-d|--test-key|-t|--hash-file|-f)
|
|
|
670361 |
+ _filedir
|
|
|
670361 |
+ return 0
|
|
|
670361 |
+ ;;
|
|
|
670361 |
+ --import-hash|--delete-hash)
|
|
|
670361 |
+ COMPREPLY=( $( compgen -W "" ) )
|
|
|
670361 |
+ return 0
|
|
|
670361 |
+ ;;
|
|
|
670361 |
+ --set-verbosity)
|
|
|
670361 |
+ COMPREPLY=( $( compgen -W "true false") )
|
|
|
670361 |
+ return 0
|
|
|
670361 |
+ ;;
|
|
|
670361 |
+ --generate-hash|-g)
|
|
|
670361 |
+ COMPREPLY=( $( compgen -o nospace -P= -W "") )
|
|
|
670361 |
+ return 0
|
|
|
670361 |
+ ;;
|
|
|
670361 |
+ *)
|
|
|
670361 |
+ return 0
|
|
|
670361 |
+ ;;
|
|
|
670361 |
+ esac
|
|
|
670361 |
+}
|
|
|
670361 |
+
|
|
|
670361 |
+complete -F _mokutil mokutil
|
|
|
670361 |
--
|
|
|
670361 |
2.17.1
|
|
|
670361 |
|