#!/usr/bin/make -f
# -*- makefile -*-
# vim: set noexpandtab:
#
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

PACKAGE = $(shell dh_listpackages)

%:
	dh $@

override_dh_install:
	dh_install
	mkdir -p $(CURDIR)/debian/$(PACKAGE)/opt/$(PACKAGE)/
	cp README.md $(CURDIR)/debian/$(PACKAGE)/opt/$(PACKAGE)/
	cp -R bin $(CURDIR)/debian/$(PACKAGE)/opt/$(PACKAGE)/
	# /!\ tag /opt/$(PACKAGE)/etc/conf.d/* as configuration files in conffiles
	# (ls | sort -V | xargs -i echo /opt/cis-hardening/etc/conf.d/{} -- without README -- with ../hardening.cfg)
	cp -R etc $(CURDIR)/debian/$(PACKAGE)/opt/$(PACKAGE)/
	cp -R lib $(CURDIR)/debian/$(PACKAGE)/opt/$(PACKAGE)/
	# cleanup git stuff if any
	find $(CURDIR)/debian/$(PACKAGE) -type f -name .gitignore -delete


override_dh_installdocs:
	dh_installdocs
	gzip -c AUTHORS > $(CURDIR)/debian/$(PACKAGE)/usr/share/doc/$(PACKAGE)/AUTHORS.gz
	gzip -c src/skel > $(CURDIR)/debian/$(PACKAGE)/usr/share/doc/$(PACKAGE)/skel.gz