#!/usr/bin/make -f

export DH_VERBOSE=1
export PYBUILD_NAME=skynet
PACKAGE = $(shell dh_listpackages)

%:
	dh $@ --with python2,systemd --buildsystem=pybuild

override_dh_auto_test:
	echo "no tests available"

override_dh_install:
	# .conf files
	mkdir -p debian/$(PACKAGE)/etc/skynet/
	install -m0644 src/skynetd/conf/skynet.conf.sample debian/$(PACKAGE)/etc/skynet/skynet.conf
	install -m0644 src/skynetd/conf/skynet-log.conf.sample debian/$(PACKAGE)/etc/skynet/skynet-log.conf
	# collectd scripts
	mkdir -p debian/$(PACKAGE)/usr/lib/collectd/
	install -m0755 src/collectd_scripts/handle_collectd_notification.py debian/$(PACKAGE)/usr/lib/collectd
	install -m0755 src/collectd_scripts/ifspeed.sh debian/$(PACKAGE)/usr/lib/collectd
	# sudoers config
	mkdir -p debian/$(PACKAGE)/etc/sudoers.d/
	install -m0644 conf/skynet-sudoers.conf debian/$(PACKAGE)/etc/sudoers.d/skynet-sudoers
	# systemd service
	install -m0644 skynetd.service debian/
	dh_installinit --name=skynetd
	# logrotate
	install -m0644 conf/skynet_logrotate.conf.sample debian/$(PACKAGE).logrotate
	dh_installlogrotate
	# everything else
	dh_auto_install
	dh_install --fail-missing
