#!/usr/bin/make -f
%:
	dh $@ --with systemd

override_dh_auto_configure:
	dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system/

override_dh_auto_install:
	dh_auto_install
	install -m0644 $(CURDIR)/misc/hdapsd.service $(CURDIR)/debian/hdapsd/lib/systemd/system/
	mv $(CURDIR)/debian/hdapsd/lib/udev/rules.d/hdapsd.rules $(CURDIR)/debian/hdapsd/usr/share/doc/hdapsd/hdapsd.rules
	rm -rf $(CURDIR)/debian/hdapsd/lib/udev/

override_dh_auto_clean:
	dh_auto_clean
	rm -f $(CURDIR)/misc/*.service

override_dh_systemd_enable:
	# Do not enable the file by default on purpose.
	# The user should enable it only after making sure the configuration is
	# appropriate for his/her computer.
	# This corresponds to START=no in /etc/default/hdapsd
	dh_systemd_enable --no-enable
