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
8 changes: 5 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,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 @@ -34,9 +33,12 @@ EXTRA_DIST = CHANGELOG.md $(pkgdata_DATA) bash_completion.sh.in .dir-locals.el \
bash-completion-config-version.cmake.in setup-symlinks.sh \
$(compat_DATA)

# Create and install empty directory for local completion scripts in sysconfdir
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
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d
10 changes: 9 additions & 1 deletion bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -3492,6 +3492,7 @@ _comp__init_collect_startup_configs()
compat_dirs+=("$BASH_COMPLETION_COMPAT_DIR")
else
# Keep in sync with Makefile.am install-data-hook
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 @@ -3503,7 +3504,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