#!/usr/bin/make -f

export DEB_BUILD_HARDENING=1

%:
	dh --with quilt $@

override_dh_auto_configure:
	autoreconf
	dh_auto_configure

override_dh_auto_install:
	dh_auto_install
	# install changelog
	dh_installchangelogs doc/ChangeLog
	# install custom configuration files
	install -m 0644 $(CURDIR)/debian/autotrust.conf $(CURDIR)/debian/keys.conf $(CURDIR)/debian/autotrust/usr/share/autotrust/
	install -d 0755 $(CURDIR)/debian/autotrust/etc/apparmor.d/
	install -m 0644 $(CURDIR)/debian/autotrust.apparmor $(CURDIR)/debian/autotrust/etc/apparmor.d/usr.sbin.autotrust
	rm $(CURDIR)/debian/autotrust/etc/autotrust/autotrust.conf.sample
	rmdir $(CURDIR)/debian/autotrust/var/run
	for anchor_file in br.anchors cz.anchors pr.anchors se.anchors anchors.mf; do \
	  install -m 0644 $(CURDIR)/debian/$$anchor_file $(CURDIR)/debian/autotrust/var/lib/autotrust/anchors/; \
	done
