#!/usr/bin/make -f

DESTDIR=`pwd`/debian/debian-edu-config

%:
	dh $@

override_dh_auto_install:
	$(MAKE) install prefix=/usr DESTDIR=$(DESTDIR)

override_dh_installinit:
	# Start it after 15bind9 and 19slapd
	dh_installinit --init-script fetch-rootca-cert -r --no-start
	# Start it after 15bind9, 19slapd and 95fetch-ldap-cert, and add some to be sure
	dh_installinit --init-script firefox-ldapconf -r --no-start
	dh_installinit --init-script chromium-ldapconf -r --no-start
	dh_installinit --init-script enable-nat --no-start

override_dh_installsystemd:
	dh_installsystemd --no-start --name chromium-ldapconf
	dh_installsystemd --no-start --name enable-nat
	dh_installsystemd --no-start --name fetch-rootca-cert
	dh_installsystemd --no-start --name firefox-ldapconf
	dh_installsystemd --no-start --name debian-edu-fsautoresize
	dh_installsystemd --no-start --name debian-edu-update-netblock
	dh_installsystemd --no-start --name debian-edu-cups-queue-autoflush
	dh_installsystemd --no-start --name debian-edu-cups-queue-autoreenable

override_dh_installman:
	dh_installman
	help2man -N -n "ldap-add-host-to-netgroup - Adds a host as a member in the given netgroup" \
		--help-option="-h" \
		--no-discard-stderr debian/debian-edu-config/usr/bin/ldap-add-host-to-netgroup \
		> debian/debian-edu-config/usr/share/man/man1/ldap-add-host-to-netgroup.1
	help2man -N -n "ldap-add-user-to-group - Adds a user as a member in the given group" \
		--help-option="-h" \
		--no-discard-stderr debian/debian-edu-config/usr/bin/ldap-add-user-to-group \
		> debian/debian-edu-config/usr/share/man/man1/ldap-add-user-to-group.1
	help2man -N -n "ldap-createuser-krb5 - Create a user and configure its kerberos principal" \
		--help-option="-h" \
		--no-discard-stderr debian/debian-edu-config/usr/bin/ldap-createuser-krb5 \
		> debian/debian-edu-config/usr/share/man/man1/ldap-createuser-krb5.1
