#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DUSE_ATASMART=YES
override_dh_auto_install:
	dh_auto_install
	rm -rf $(CURDIR)/debian/thinkfan/etc/systemd/
	rm $(CURDIR)/debian/thinkfan/usr/share/doc/thinkfan/thinkfan.yaml
	rm $(CURDIR)/debian/thinkfan/usr/share/doc/thinkfan/COPYING
	install -D -m0644 examples/thinkfan.yaml $(CURDIR)/debian/thinkfan/usr/share/doc/thinkfan/examples/thinkfan.yaml
	install -D -m0755 rcscripts/sysvinit/thinkfan.init $(CURDIR)/debian/thinkfan/etc/init.d/thinkfan
	install -D -m0644 rcscripts/sysvinit/thinkfan.default $(CURDIR)/debian/thinkfan/etc/default/thinkfan

override_dh_installinit:
	dh_installinit --onlyscripts

override_dh_installsystemd:
	# Do not enable the file by default on purpose.
	# The user should enable it only after making sure the configuration is
	# appropriate for their computer.
	# This corresponds to START=no in /etc/default/thinkfan
	dh_installsystemd --no-enable
