From dd30aa427cdac181b30ce0fdee122dc8b524701b Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Tue, 29 Dec 2009 23:50:08 +0100 Subject: [PATCH] substitute path to bash_completion time in profile script according to actual installation path --- Makefile.am | 7 ++++++- bash_completion.sh | 2 +- bash_completion.sh.in | 10 ++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 bash_completion.sh.in diff --git a/Makefile.am b/Makefile.am index 0dc3c47d..5b1a0616 100644 --- a/Makefile.am +++ b/Makefile.am @@ -155,5 +155,10 @@ bashcomp_DATA = contrib/abook \ profiledir = $(sysconfdir)/profile.d profile_DATA = bash_completion.sh -EXTRA_DIST = CHANGES $(sysconf_DATA) $(bashcomp_DATA) $(profile_DATA) \ +bash_completion.sh: bash_completion.sh.in Makefile + sed -e 's|@sysconfdir[@]|$(sysconfdir)|' <$(srcdir)/$@.in >$@ + +CLEANFILES = bash_completion.sh + +EXTRA_DIST = CHANGES $(sysconf_DATA) $(bashcomp_DATA) bash_completion.sh.in \ contrib/_modules contrib/_subversion contrib/_yum contrib/_yum-utils diff --git a/bash_completion.sh b/bash_completion.sh index ee1220e3..1ee09142 100644 --- a/bash_completion.sh +++ b/bash_completion.sh @@ -5,6 +5,6 @@ bash=${BASH_VERSION%.*}; bmajor=${bash%.*} if [ $bmajor -ge 3 -a -r /etc/bash_completion ]; then # Source completion code. - . /etc/bash_completion + . /usr/local/etc/bash_completion fi unset bash bmajor diff --git a/bash_completion.sh.in b/bash_completion.sh.in new file mode 100644 index 00000000..2ea07f77 --- /dev/null +++ b/bash_completion.sh.in @@ -0,0 +1,10 @@ +# Check for interactive bash and that we haven't already been sourced. +[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return + +# Check for recent enough version of bash. +bash=${BASH_VERSION%.*}; bmajor=${bash%.*} +if [ $bmajor -ge 3 -a -r /etc/bash_completion ]; then + # Source completion code. + . @sysconfdir@/bash_completion +fi +unset bash bmajor