#! /usr/bin/make -f

export PYBUILD_BEFORE_BUILD=\
	echo usr/lib/python{version.major}/dist-packages/libinithooks/inithooks_cache.py \
	usr/lib/inithooks/bin/inithooks_cache.py \
	> debian/inithooks.links

export PYTHONDONTWRITEBYTECODE=1

%:
	dh $@ --with=python3 --buildsystem=pybuild

override_dh_auto_install:
	# The metapackage has no payload. Keep the Python library and its metadata
	# in inithooks when debhelper sees more than one binary package.
	dh_auto_install --destdir=debian/inithooks

override_dh_fixperms:
	dh_fixperms
	# This Python module is also the executable target of the cache command.
	chmod 755 debian/inithooks/usr/lib/python3/dist-packages/libinithooks/inithooks_cache.py

override_dh_installsystemd:
	dh_installsystemd --name=inithooks
	dh_installsystemd --name=inithooks-restart-getty1
	dh_installsystemd --name=turnkey-init-fence
	dh_installsystemd --name=turnkey-onboarding
