#!/usr/bin/make -f

PACKAGE   = $(shell dh_listpackages)
TMP       = $(CURDIR)/debian/$(PACKAGE)
BUILDHOME = $(CURDIR)/debian/build

%:
	dh $@

override_dh_auto_test:
	# t/rester.conf gets modified during tests. backup it and copy it back.
	cp $(CURDIR)/t/rester.conf $(CURDIR)/debian/rester.conf.bak
	mkdir -p $(BUILDHOME)
	HOME=$(BUILDHOME) dh_auto_test
	[ ! -f $(CURDIR)/debian/rester.conf.bak ] || mv $(CURDIR)/debian/rester.conf.bak $(CURDIR)/t/rester.conf

override_dh_clean:
	dh_clean
	rm -rf $(BUILDHOME)

override_dh_auto_install:
	dh_auto_install
	rm $(TMP)/usr/bin/*
	rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/bin

# bug #711131 in debhelper 9.20130604
override_dh_installchangelogs:
	dh_installchangelogs Changes
