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

# postinst generates /etc/ddclient.conf via debconf.  Move the default
# /etc/ddclient.conf to the examples directory to prevent it from interfering.
#
# TODO: It seems like it should be possible to use dh_install to move the file,
# but I couldn't figure out how to make it work.  Adding the following line to
# debian/ddclient.install copies the file rather than renames it (as of
# debhelper 13):
#
#     debian/ddclient/etc/ddclient.conf => /usr/share/doc/ddclient/examples/sample-etc_ddclient.conf
#
# dh_installexamples similarly copies the file (and it doesn't provide a way to
# rename it).
execute_after_dh_auto_install:
	install -d debian/ddclient/usr/share/doc/ddclient/examples
	mv debian/ddclient/etc/ddclient.conf debian/ddclient/usr/share/doc/ddclient/examples/sample-etc_ddclient.conf

# This package conditionally enables the ddclient service based on
# debconf answers.
#
# The --no-start flag is required because --no-enable only controls
# whether the service is enabled, not whether the service is started.
override_dh_installinit:
	dh_installinit --no-enable --no-start
override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start

%.8 : %.xml
	xmlto -o $(@D) man $<
