#!/usr/bin/make -f

# Do not try to strip Go binaries
export DEB_BUILD_OPTIONS := nostrip

%:
	dh $@ --with bash-completion

override_dh_auto_test:

override_dh_auto_install:
	echo $(DEB_BUILD_OPTIONS)
	dh_auto_install

	bin/frostfs-adm gendoc --type man man/
	bin/frostfs-cli gendoc --type man man/

	bin/frostfs-adm completion bash > debian/frostfs-adm.bash-completion
	bin/frostfs-cli completion bash > debian/frostfs-cli.bash-completion
	install -m 0755 -d debian/frostfs-cli/usr/share/fish/completions/
	install -m 0755 -d debian/frostfs-cli/usr/share/zsh/vendor-completions/
	bin/frostfs-adm completion fish > debian/frostfs-cli/usr/share/fish/completions/frostfs-adm.fish
	bin/frostfs-adm completion zsh > debian/frostfs-cli/usr/share/zsh/vendor-completions/_frostfs-adm
	bin/frostfs-cli completion fish > debian/frostfs-cli/usr/share/fish/completions/frostfs-cli.fish
	bin/frostfs-cli completion zsh > debian/frostfs-cli/usr/share/zsh/vendor-completions/_frostfs-cli

	install -T -m 0640 config/example/ir.yaml debian/frostfs-ir/etc/frostfs/ir/config.yml
	install -T -m 0640 config/example/ir-control.yaml debian/frostfs-ir/etc/frostfs/ir/control.yml
	install -T -m 0640 config/example/node.yaml debian/frostfs-storage/etc/frostfs/storage/config.yml
	install -T -m 0640 config/example/node-control.yaml debian/frostfs-storage/etc/frostfs/storage/control.yml

override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start --name=frostfs-ir
	dh_installsystemd --no-enable --no-start --name=frostfs-storage

override_dh_installchangelogs:
	dh_installchangelogs -k CHANGELOG.md

override_dh_installdocs:
	dh_installdocs