#!/usr/bin/make -f

PACKAGE = $(firstword $(shell dh_listpackages))
PKG_DIR = $(CURDIR)/debian/$(PACKAGE)

export PYBUILD_NAME=nrpe-ng
export PYBUILD_TEST_NOSE=1
export PYBUILD_TEST_ARGS=-c $(CURDIR)/setup.cfg

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_install:
	dh_install
	cp $(CURDIR)/config/nagios_check_nrpe_ng.cfg \
		$(PKG_DIR)/etc/nagios-plugins/config/check_nrpe_ng.cfg
	mv $(PKG_DIR)/usr/bin/check_nrpe_ng $(PKG_DIR)/usr/lib/nagios/plugins/
	mv $(PKG_DIR)/usr/bin/nrpe-ng $(PKG_DIR)/usr/sbin/
	rmdir $(PKG_DIR)/usr/bin/
	find $(PKG_DIR)/ -type f -name .coverage -delete

override_dh_auto_clean:
	dh_auto_clean
	rm -rf nrpe_ng.egg-info/
