summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--INSTALL8
-rw-r--r--Makefile59
2 files changed, 36 insertions, 31 deletions
diff --git a/INSTALL b/INSTALL
index f267f80..3c37f14 100644
--- a/INSTALL
+++ b/INSTALL
@@ -17,10 +17,10 @@ SYSCONFDIR default: /etc
The install target will automatically determine the existance
of bash, zsh, and fish, and install the completion files as
-needed. If you'd like to force installation, you may set
-FORCE_BASHCOMP, FORCE_ZSHCOMP, or FORCE_FISHCOMP to 1, or set
-FORCE_ALL to 1. The exact paths of the completions can be
-controlled with BASHCOMP_PATH, ZSHCOMP_PATH, and FISHCOMP_PATH.
+needed. If you'd like to choose manually, you may set WITH_ALLCOMP,
+WITH_BASHCOMP, WITH_ZSHCOMP, or WITH_FISHCOMP to "yes" or "no". The
+exact paths of the completions can be controlled with BASHCOMPDIR,
+ZSHCOMPDIR, and FISHCOMPDIR.
-- Test Suite --
diff --git a/Makefile b/Makefile
index 09352da..eac2291 100644
--- a/Makefile
+++ b/Makefile
@@ -6,23 +6,29 @@ MANDIR ?= $(PREFIX)/share/man
PLATFORMFILE := src/platform/$(shell uname | cut -d _ -f 1 | tr '[:upper:]' '[:lower:]').sh
-BASHCOMP_PATH ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
-ZSHCOMP_PATH ?= $(DESTDIR)$(PREFIX)/share/zsh/site-functions
-FISHCOMP_PATH ?= $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d
+BASHCOMPDIR ?= $(PREFIX)/share/bash-completion/completions
+ZSHCOMPDIR ?= $(PREFIX)/share/zsh/site-functions
+FISHCOMPDIR ?= $(PREFIX)/share/fish/vendor_completions.d
-ifeq ($(FORCE_ALL),1)
-FORCE_BASHCOMP := 1
-FORCE_ZSHCOMP := 1
-FORCE_FISHCOMP := 1
+ifneq ($(WITH_ALLCOMP),)
+WITH_BASHCOMP := $(WITH_ALLCOMP)
+WITH_ZSHCOMP := $(WITH_ALLCOMP)
+WITH_FISHCOMP := $(WITH_ALLCOMP)
endif
-ifneq ($(strip $(wildcard $(BASHCOMP_PATH))),)
-FORCE_BASHCOMP := 1
+ifeq ($(WITH_BASHCOMP),)
+ifneq ($(strip $(wildcard $(BASHCOMPDIR))),)
+WITH_BASHCOMP := yes
endif
-ifneq ($(strip $(wildcard $(ZSHCOMP_PATH))),)
-FORCE_ZSHCOMP := 1
endif
-ifneq ($(strip $(wildcard $(FISHCOMP_PATH))),)
-FORCE_FISHCOMP := 1
+ifeq ($(WITH_ZSHCOMP),)
+ifneq ($(strip $(wildcard $(ZSHCOMPDIR))),)
+WITH_ZSHCOMP := yes
+endif
+endif
+ifeq ($(WITH_FISHCOMP),)
+ifneq ($(strip $(wildcard $(FISHCOMPDIR))),)
+WITH_FISHCOMP := yes
+endif
endif
all:
@@ -30,34 +36,33 @@ all:
install-common:
@install -v -d "$(DESTDIR)$(MANDIR)/man1" && install -m 0644 -v man/pass.1 "$(DESTDIR)$(MANDIR)/man1/pass.1"
-
- @[ "$(FORCE_BASHCOMP)" = "1" ] && install -v -d "$(DESTDIR)$(BASHCOMP_PATH)" && install -m 0644 -v src/completion/pass.bash-completion "$(DESTDIR)$(BASHCOMP_PATH)/pass" || true
- @[ "$(FORCE_ZSHCOMP)" = "1" ] && install -v -d "$(DESTDIR)$(ZSHCOMP_PATH)" && install -m 0644 -v src/completion/pass.zsh-completion "$(DESTDIR)$(ZSHCOMP_PATH)/_pass" || true
- @[ "$(FORCE_FISHCOMP)" = "1" ] && install -v -d "$(DESTDIR)$(FISHCOMP_PATH)" && install -m 0644 -v src/completion/pass.fish-completion "$(DESTDIR)$(FISHCOMP_PATH)/pass.fish" || true
+ @[ "$(WITH_BASHCOMP)" = "yes" ] || exit 0; install -v -d "$(DESTDIR)$(BASHCOMPDIR)" && install -m 0644 -v src/completion/pass.bash-completion "$(DESTDIR)$(BASHCOMPDIR)/pass"
+ @[ "$(WITH_ZSHCOMP)" = "yes" ] || exit 0; install -v -d "$(DESTDIR)$(ZSHCOMPDIR)" && install -m 0644 -v src/completion/pass.zsh-completion "$(DESTDIR)$(ZSHCOMPDIR)/_pass"
+ @[ "$(WITH_FISHCOMP)" = "yes" ] || exit 0; install -v -d "$(DESTDIR)$(FISHCOMPDIR)" && install -m 0644 -v src/completion/pass.fish-completion "$(DESTDIR)$(FISHCOMPDIR)/pass.fish"
ifneq ($(strip $(wildcard $(PLATFORMFILE))),)
install: install-common
@install -v -d "$(DESTDIR)$(LIBDIR)/password-store" && install -m 0644 -v "$(PLATFORMFILE)" "$(DESTDIR)$(LIBDIR)/password-store/platform.sh"
+ @install -v -d "$(DESTDIR)$(LIBDIR)/password-store/extensions"
@install -v -d "$(DESTDIR)$(BINDIR)/"
- sed 's:.*PLATFORM_FUNCTION_FILE.*:source "$(LIBDIR)/password-store/platform.sh":;s:^SYSTEM_EXTENSION_DIR=.*:SYSTEM_EXTENSION_DIR="$(LIBDIR)/password-store/extensions":' src/password-store.sh > "$(DESTDIR)$(BINDIR)/pass"
- @chmod 0755 "$(DESTDIR)$(BINDIR)/pass"
+ @trap 'rm -f src/.pass' EXIT; sed 's:.*PLATFORM_FUNCTION_FILE.*:source "$(LIBDIR)/password-store/platform.sh":;s:^SYSTEM_EXTENSION_DIR=.*:SYSTEM_EXTENSION_DIR="$(LIBDIR)/password-store/extensions":' src/password-store.sh > src/.pass && \
+ install -v -d "$(DESTDIR)$(BINDIR)/" && install -m 0755 -v src/.pass "$(DESTDIR)$(BINDIR)/pass"
else
install: install-common
- @install -v -d "$(DESTDIR)$(BINDIR)/"
- sed '/PLATFORM_FUNCTION_FILE/d;s:^SYSTEM_EXTENSION_DIR=.*:SYSTEM_EXTENSION_DIR="$(LIBDIR)/password-store/extensions":' src/password-store.sh > "$(DESTDIR)$(BINDIR)/pass"
- @chmod 0755 "$(DESTDIR)$(BINDIR)/pass"
+ @install -v -d "$(DESTDIR)$(LIBDIR)/password-store/extensions"
+ @trap 'rm -f src/.pass' EXIT; sed '/PLATFORM_FUNCTION_FILE/d;s:^SYSTEM_EXTENSION_DIR=.*:SYSTEM_EXTENSION_DIR="$(LIBDIR)/password-store/extensions":' src/password-store.sh > src/.pass && \
+ install -v -d "$(DESTDIR)$(BINDIR)/" && install -m 0755 -v src/.pass "$(DESTDIR)$(BINDIR)/pass"
endif
uninstall:
@rm -vrf \
"$(DESTDIR)$(BINDIR)/pass" \
- "$(DESTDIR)$(LIBDIR)/password-store/" \
+ "$(DESTDIR)$(LIBDIR)/password-store" \
"$(DESTDIR)$(MANDIR)/man1/pass.1" \
- "$(DESTDIR)$(BASHCOMP_PATH)/pass" \
- "$(DESTDIR)$(ZSHCOMP_PATH)/_pass" \
- "$(DESTDIR)$(FISHCOMP_PATH)/pass.fish"
- @rmdir "$(DESTDIR)$(LIBDIR)/password-store/" 2>/dev/null || true
+ "$(DESTDIR)$(BASHCOMPDIR)/pass" \
+ "$(DESTDIR)$(ZSHCOMPDIR)/_pass" \
+ "$(DESTDIR)$(FISHCOMPDIR)/pass.fish"
TESTS = $(sort $(wildcard tests/t[0-9][0-9][0-9][0-9]-*.sh))