#!/usr/bin/make -f

PACKAGE = $(shell dh_listpackages)
# This include gives us DEB_VERSION
include /usr/share/dpkg/pkg-info.mk

%:
	dh $@

# Install some extra files
override_dh_auto_install:
	mkdir -p debian/$(PACKAGE)/usr/share/man/man1
	set -e; for script in `ls usr/sbin` ; do \
	    pod2man --release=$(DEB_VERSION) --section 1 \
		--center=$(PACKAGE) usr/sbin/$${script} \
		> debian/$(PACKAGE)/usr/share/man/man1/$$script.1 ; \
	done
	#
	mkdir -p debian/$(PACKAGE)/etc/remctl/conf.d
	ls -l $(CURDIR)/etc/remctl/conf.d/
	cp $(CURDIR)/etc/remctl/conf.d/puppetca debian/$(PACKAGE)/etc/remctl/conf.d/puppetca
	#
	dh_auto_install
	rsync -C --recursive --links --perms --times \
	  --exclude-from=debian/exclude.rsync --exclude debian $(CURDIR)/usr/sbin debian/$(PACKAGE)/usr/
