Allow install ZSH completion to site-functions directory

This commit is contained in:
Sergei Eremenko 2019-06-26 18:57:58 +03:00
parent 475b8f1843
commit b34b906132
2 changed files with 13 additions and 6 deletions

View file

@ -4,6 +4,7 @@
PREFIX ?= /usr
PROGNAME := papirus-folders
VERSION ?=
ZSHCOMPDIR ?= $(PREFIX)/share/zsh/vendor-completions
all:
@ -13,14 +14,14 @@ install:
mkdir -p $(DESTDIR)$(PREFIX)/share/bash-completion/completions
install -m 644 completion/$(PROGNAME) \
$(DESTDIR)$(PREFIX)/share/bash-completion/completions
mkdir -p $(DESTDIR)$(PREFIX)/share/zsh/vendor-completions
mkdir -p $(DESTDIR)$(ZSHCOMPDIR)
install -m 644 completion/_$(PROGNAME) \
$(DESTDIR)$(PREFIX)/share/zsh/vendor-completions
$(DESTDIR)$(ZSHCOMPDIR)
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGNAME)
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$(PROGNAME)
rm -f $(DESTDIR)$(PREFIX)/share/zsh/vendor-completions/_$(PROGNAME)
rm -f $(DESTDIR)$(ZSHCOMPDIR)/_$(PROGNAME)
_get_version:
$(if $(VERSION),,$(error VERSION is not defined. Pass via "make bump VERSION=0.1.2"))

View file

@ -54,6 +54,7 @@ _uninstall() {
_msg "Deleting $gh_desc ..."
_rm "$PREFIX/bin/$bin_name"
_rm "$PREFIX/share/bash-completion/completions/$bin_name"
_rm "$PREFIX/share/zsh/site-functions/_$bin_name"
_rm "$PREFIX/share/zsh/vendor-completions/_$bin_name"
}
@ -68,9 +69,14 @@ _install() {
sudo mkdir -p "$PREFIX/share/bash-completion/completions"
sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/$bin_name" \
"$PREFIX/share/bash-completion/completions"
sudo mkdir -p "$PREFIX/share/zsh/vendor-completions"
sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/_$bin_name" \
"$PREFIX/share/zsh/vendor-completions"
if [ -d "$PREFIX/share/zsh/site-functions" ]; then
sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/_$bin_name" \
"$PREFIX/share/zsh/site-functions"
elif [ -d "$PREFIX/share/zsh/vendor-completions" ]; then
sudo install -m 644 "$temp_dir/$gh_repo-$tag/completion/_$bin_name" \
"$PREFIX/share/zsh/vendor-completions"
else :
fi
}
_cleanup() {