#!/usr/bin/make -f

# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

include /usr/share/dpkg/pkg-info.mk

export GOCACHE=$(CURDIR)/vendor
export GOPATH=$(CURDIR)/vendor

# Needed to run sliver binaries to create shell autocompletions
export SLIVER_ROOT_DIR=/tmp
export SLIVER_CLIENT_ROOT_DIR=/tmp

%:
	dh $@

execute_after_dh_auto_install:
	# install bash/zsh completion
	mkdir -p debian/sliver/usr/share/bash-completion/completions debian/sliver/usr/share/zsh/vendor-completions/
	./sliver-server completion bash > debian/sliver/usr/share/bash-completion/completions/sliver-server
	./sliver-client completion bash > debian/sliver/usr/share/bash-completion/completions/sliver-client
	./sliver-server completion zsh > debian/sliver/usr/share/zsh/vendor-completions/_sliver-server
	./sliver-client completion zsh > debian/sliver/usr/share/zsh/vendor-completions/_sliver-client
