Skip to content

Commit

Permalink
contrib: bash_completion.d: make install destination vendor dependent
Browse files Browse the repository at this point in the history
Certain Linux distributions (Debian/Ubuntu at least) expect
bash-completion snippets to be installed in
/usr/share/bash-completion/completions instead of
/etc/bash_completion.d.

This patch sets the bashcompletiondir variable based on the vendor,
inspired by similar settings for initdir and initconfdir.

It seems that commit 612b8df
caused the file to be installed in the first-place (thus the error
when building debian packages only became apparent when testing a
2.2.0-rc4 build)

The change only sets the variable in Makefile context - the
rpm/zfs.spec.in file has the path hardcoded as
%{_sysconfdir}/bash_completion.d/zfs, but since running
```
./configure --sysconfdir=/myetc  ; make rpm
```
also results in all relevant files to be installed in /etc instead of
/myetc I assume this can remain as is.

Reviewed-by: Umer Saleem <usaleem@ixsystems.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Closes openzfs#15304
  • Loading branch information
Stoiko Ivanov authored and behlendorf committed Oct 3, 2023
1 parent 4e16964 commit e69ade3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 11 additions & 0 deletions config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,17 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
AC_MSG_RESULT([no])
fi
AC_SUBST(RPM_DEFINE_INITRAMFS)
AC_MSG_CHECKING([default bash completion directory])
case "$VENDOR" in
ubuntu) bashcompletiondir=/usr/share/bash-completion/completions ;;
debian) bashcompletiondir=/usr/share/bash-completion/completions ;;
freebsd) bashcompletiondir=$sysconfdir/bash_completion.d;;
*) bashcompletiondir=/etc/bash_completion.d ;;
esac
AC_MSG_RESULT([$bashcompletiondir])
AC_SUBST(bashcompletiondir)
])

dnl #
Expand Down
2 changes: 0 additions & 2 deletions contrib/bash_completion.d/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
bashcompletiondir = $(sysconfdir)/bash_completion.d

nodist_bashcompletion_DATA = %D%/zfs
SUBSTFILES += $(nodist_bashcompletion_DATA)

Expand Down

0 comments on commit e69ade3

Please sign in to comment.