Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SUBDIRS = completions doc helpers test
pkgdata_DATA = bash_completion

# Empty, but here just to get the compat dir created with install
compatdir = $(sysconfdir)/bash_completion.d
compatdir = $(datadir)/bash-completion/compat
compat_DATA = bash_completion.d/000_bash_completion_compat.bash

profiledir = $(sysconfdir)/profile.d
Expand Down Expand Up @@ -36,7 +36,8 @@ EXTRA_DIST = CHANGELOG.md $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \

install-data-hook:
tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \
$(SED) -e 's|-/etc/bash_completion\.d|-$(compatdir)|' \
$(SED) -e 's|(/etc/bash_completion\.d|($(sysconfdir)/bash_completion.d|' \
-e 's|(/usr/share/bash-completion/compat|($(compatdir)|' \
$(DESTDIR)$(datadir)/$(PACKAGE)/bash_completion >$$tmpfile && \
cat $$tmpfile >$(DESTDIR)$(datadir)/$(PACKAGE)/bash_completion && \
rm $$tmpfile
11 changes: 10 additions & 1 deletion bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -3424,6 +3424,8 @@ _comp__init_collect_startup_configs()
if [[ ${BASH_COMPLETION_COMPAT_DIR-} ]]; then
compat_dirs+=("$BASH_COMPLETION_COMPAT_DIR")
else
# Keep in sync with install-data-hook at Makefile.am
compat_dirs+=(/usr/share/bash-completion/compat)
compat_dirs+=(/etc/bash_completion.d)
# Similarly as for the "completions" dir, look up from relative to
# bash_completion, primarily for installed-with-prefix and
Expand All @@ -3435,7 +3437,14 @@ _comp__init_collect_startup_configs()
else
compat_dir=$_comp__base_directory/bash_completion.d
fi
[[ ${compat_dirs[0]} == "$compat_dir" ]] ||
local dir
for dir in "${compat_dirs[@]}"; do
if [[ $dir == "$compat_dir" ]]; then
compat_dir=""
break
fi
done
[[ $compat_dir ]] &&
compat_dirs+=("$compat_dir")
fi
for compat_dir in "${compat_dirs[@]}"; do
Expand Down