Skip to content

Commit e5f4767

Browse files
committed
feat: load compatdir from /usr/share too and install our script there
In distributions we are in the process of moving data shipped by upstream projects to /usr/ and out of /etc/, as the latter is really meant to be for local changes, not for upstream projects to ship programs/data. Add support for sourcing compat scripts from /usr/share/bash-completion/compat/ together with /etc/bash_completion.d, and move 000_bash_completion_compat.bash to the former.
1 parent 70f6215 commit e5f4767

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SUBDIRS = completions doc helpers test
33
pkgdata_DATA = bash_completion
44

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

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

3737
install-data-hook:
3838
tmpfile=`mktemp $${TMPDIR:-/tmp}/bash_completion.XXXXXX` && \
39-
$(SED) -e 's|(/etc/bash_completion\.d|($(compatdir)|' \
39+
$(SED) -e 's|(/etc/bash_completion\.d|($(sysconfdir)/bash_completion.d|' \
40+
-e 's|(/usr/share/bash-completion/compat|($(compatdir)|' \
4041
$(DESTDIR)$(datadir)/$(PACKAGE)/bash_completion >$$tmpfile && \
4142
cat $$tmpfile >$(DESTDIR)$(datadir)/$(PACKAGE)/bash_completion && \
4243
rm $$tmpfile

bash_completion

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3425,6 +3425,7 @@ _comp__init_collect_startup_configs()
34253425
compat_dirs+=("$BASH_COMPLETION_COMPAT_DIR")
34263426
else
34273427
# Keep in sync with install-data-hook at Makefile.am
3428+
compat_dirs+=(/usr/share/bash-completion/compat)
34283429
compat_dirs+=(/etc/bash_completion.d)
34293430
# Similarly as for the "completions" dir, look up from relative to
34303431
# bash_completion, primarily for installed-with-prefix and
@@ -3436,7 +3437,7 @@ _comp__init_collect_startup_configs()
34363437
else
34373438
compat_dir=$_comp__base_directory/bash_completion.d
34383439
fi
3439-
[[ ${compat_dirs[0]} == "$compat_dir" ]] ||
3440+
[[ ${compat_dirs[0]} == "$compat_dir" ]] || [[ ${compat_dirs[1]} == "$compat_dir" ]] ||
34403441
compat_dirs+=("$compat_dir")
34413442
fi
34423443
for compat_dir in "${compat_dirs[@]}"; do

0 commit comments

Comments
 (0)