#!/usr/bin/make -f

# This defines DEB_VERSION:
include /usr/share/dpkg/pkg-info.mk

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PACKAGE = $(shell dh_listpackages)

%:
		dh $@

override_dh_auto_install:
		rsync -C --recursive --links --perms --times --delete \
		--exclude debian --exclude archive --exclude README.md --exclude make-man-page $(CURDIR)/ debian/$(PACKAGE)

		# Build man pages for all of our Perl-script commands
		mkdir -p debian/$(PACKAGE)/usr/share/man/man8
		for script in `ls usr/sbin` ; do \
			pod2man --release $(DEB_VERSION) --section 8 \
			--center "System Commands" usr/sbin/$${script} \
			> debian/$(PACKAGE)/usr/share/man/man8/$${script}.8 ; \
		done
