#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

VERSION=$(shell head -n1 debian/changelog |sed -e 's/.*(\(.*\)).*/\1/')

%:
	dh $@

override_dh_installinit:
	dh_installinit -pedubuntu-server-host --name edubuntu-server --no-restart-on-upgrade
	dh_installinit -pedubuntu-server-manager --name edubuntu-server-manager

override_dh_installman:
	mkdir -p $(CURDIR)/debian/edubuntu-server-client/usr/share/man/man1/
	help2man --name="Edubuntu server client" --version-string=$(VERSION) -N $(CURDIR)/client/sbin/edubuntu-server-auth > $(CURDIR)/debian/edubuntu-server-client/usr/share/man/man1/edubuntu-server-auth.1

	mkdir -p $(CURDIR)/debian/edubuntu-server-host/usr/share/man/man1/
	help2man --name="Edubuntu server template builder" --version-string=$(VERSION) -N $(CURDIR)/host/sbin/edubuntu-server-build-template > $(CURDIR)/debian/edubuntu-server-host/usr/share/man/man1/edubuntu-server-build-template.1
	help2man --name="Edubuntu server deployment script" --version-string=$(VERSION) -N $(CURDIR)/host/sbin/edubuntu-server-deploy > $(CURDIR)/debian/edubuntu-server-host/usr/share/man/man1/edubuntu-server-deploy.1
	help2man --name="Edubuntu server management script" --version-string=$(VERSION) -N $(CURDIR)/host/sbin/edubuntu-server-manage > $(CURDIR)/debian/edubuntu-server-host/usr/share/man/man1/edubuntu-server-manage.1

	mkdir -p $(CURDIR)/debian/edubuntu-server-manager/usr/share/man/man1/
	help2man --name="Edubuntu server management web interface" --version-string=$(VERSION) -N $(CURDIR)/manager/edubuntu-server-manager > $(CURDIR)/debian/edubuntu-server-manager/usr/share/man/man1/edubuntu-server-manager.1


	dh_installman
