From d3cab75d7e79fbc89ef08df3e6d2b1e28b4ef163 Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Thu, 3 Nov 2016 10:34:53 +0100 Subject: Build: integrate contrib directory into build system BASH completion is now installed by make install. https://fedorahosted.org/freeipa/ticket/6418 Reviewed-By: Martin Basti Reviewed-By: Christian Heimes --- Makefile.am | 4 ++-- contrib/Makefile.am | 4 ++++ contrib/completion/Makefile.am | 4 ++++ contrib/completion/ipa | 32 ++++++++++++++++++++++++++++++++ contrib/completion/ipa.bash_completion | 32 -------------------------------- freeipa.spec.in | 2 -- 6 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 contrib/Makefile.am create mode 100644 contrib/completion/Makefile.am create mode 100644 contrib/completion/ipa delete mode 100644 contrib/completion/ipa.bash_completion diff --git a/Makefile.am b/Makefile.am index a390b4eb6..e752585d8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,4 @@ -SUBDIRS = asn1 util client daemons install ipaclient ipalib ipaplatform ipapython ipaserver ipatests po -# contrib +SUBDIRS = asn1 util client contrib daemons install ipaclient ipalib ipaplatform ipapython ipaserver ipatests po # doc # init @@ -23,5 +22,6 @@ EXTRA_DIST = .mailmap \ BUILD.txt \ Contributors.txt \ COPYING.openssl \ + contrib \ pylintrc \ pytest.ini diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 000000000..108a8087d --- /dev/null +++ b/contrib/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = completion + +EXTRA_DIST = \ + nssciphersuite diff --git a/contrib/completion/Makefile.am b/contrib/completion/Makefile.am new file mode 100644 index 000000000..d82c2d9a7 --- /dev/null +++ b/contrib/completion/Makefile.am @@ -0,0 +1,4 @@ +bashcompdir = $(sysconfdir)/bash_completion.d + +bashcomp_SCRIPTS = \ + ipa diff --git a/contrib/completion/ipa b/contrib/completion/ipa new file mode 100644 index 000000000..33ad1709b --- /dev/null +++ b/contrib/completion/ipa @@ -0,0 +1,32 @@ +# -*- shell-script -*- +# Programmable completion for the IPA ipa command under bash. Source +# this file (or on some systems add it to ~/.bash_completion and start a new +# shell) and bash's completion mechanism will know all about ipa's options! + +# Known to work with bash 2.05a with programmable completion and extended +# pattern matching enabled (use 'shopt -s extglob progcomp' to enable +# these if they are not already enabled). + +# based on the bzr bash completion script by Martin Pool + +_ipa_commands() +{ + ipa help commands 2>/dev/null | sed -r 's/^([-[:alnum:]]*).*/\1/' | grep '^[[:alnum:]]' +} + +_ipa() +{ + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W "$(_ipa_commands)" $cur ) ) + elif [ $COMP_CWORD -eq 2 ]; then + case "$prev" in + help) + COMPREPLY=( $( compgen -W "$(_ipa_commands) commands" $cur ) ) + ;; + esac + fi +} + +complete -F _ipa -o default ipa diff --git a/contrib/completion/ipa.bash_completion b/contrib/completion/ipa.bash_completion deleted file mode 100644 index 33ad1709b..000000000 --- a/contrib/completion/ipa.bash_completion +++ /dev/null @@ -1,32 +0,0 @@ -# -*- shell-script -*- -# Programmable completion for the IPA ipa command under bash. Source -# this file (or on some systems add it to ~/.bash_completion and start a new -# shell) and bash's completion mechanism will know all about ipa's options! - -# Known to work with bash 2.05a with programmable completion and extended -# pattern matching enabled (use 'shopt -s extglob progcomp' to enable -# these if they are not already enabled). - -# based on the bzr bash completion script by Martin Pool - -_ipa_commands() -{ - ipa help commands 2>/dev/null | sed -r 's/^([-[:alnum:]]*).*/\1/' | grep '^[[:alnum:]]' -} - -_ipa() -{ - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - if [ $COMP_CWORD -eq 1 ]; then - COMPREPLY=( $( compgen -W "$(_ipa_commands)" $cur ) ) - elif [ $COMP_CWORD -eq 2 ]; then - case "$prev" in - help) - COMPREPLY=( $( compgen -W "$(_ipa_commands) commands" $cur ) ) - ;; - esac - fi -} - -complete -F _ipa -o default ipa diff --git a/freeipa.spec.in b/freeipa.spec.in index e60270ac0..6a8d31386 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -833,8 +833,6 @@ mkdir -p %{buildroot}%{_sysconfdir}/ipa/ /bin/touch %{buildroot}%{_sysconfdir}/ipa/ca.crt mkdir -p %{buildroot}%{_sysconfdir}/ipa/nssdb mkdir -p %{buildroot}/%{_localstatedir}/lib/ipa-client/sysrestore -mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d -install -pm 644 contrib/completion/ipa.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/ipa %if ! %{ONLY_CLIENT} mkdir -p %{buildroot}%{_sysconfdir}/cron.d -- cgit