#!/usr/bin/make -f

%:
	dh $@

override_dh_installsystemd:
	dh_installsystemd --no-start --no-enable

override_dh_install:
	dh_install --exclude=.pyc

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cp data/server/king_phisher/server_config.yml debian/
	sed -i "s%/var/lib/king-phisher%/tmp/fakehome/lib/king-phisher%g" data/server/king_phisher/server_config.yml
	mkdir /tmp/fakehome
	HOME=/tmp/fakehome xvfb-run python3 -m unittest -v tests
	cp debian/server_config.yml data/server/king_phisher
endif

override_dh_auto_build:
	dh_auto_build
	PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/source build/html

override_dh_installdocs:
	dh_installdocs -Xdoctrees
	rm debian/king-phisher/usr/share/doc/king-phisher/html/_static/fonts/Lato*.ttf
	rm debian/king-phisher/usr/share/doc/king-phisher/html/_static/fonts/fontawesome-webfont.*

override_dh_fixperms:
	dh_fixperms
	chmod 644 debian/king-phisher/usr/share/king-phisher/king_phisher/server/__main__.py
	chmod 644 debian/king-phisher/usr/share/king-phisher/king_phisher/client/__main__.py
