PACKAGE = debian-edu-config

PROGS = cfengine-debian-edu cfengine-skolelinux \
        update-ini-file update-hostname-from-ip \
	debian-edu-hd-warn skolelinux-hd-warn debian-edu-lessdisks \
	debian-edu-ltsp debian-edu-pxelinux.cfg

SPROGS = debian-edu-restart-services skolelinux-restart-services \
	debian-edu-test-install skolelinux-test-install ltsp-make-client

INSTALL     = install -p -m 755
INSTALL_DATA= install -D -p -m 644

prefix     = /usr/local
sysconfdir = /etc
cfdir      = $(sysconfdir)/cfengine/debian-edu
bindir     = $(prefix)/bin
sbindir    = $(prefix)/sbin
docdir     = $(prefix)/share/doc/$(PACKAGE)
mandir     = $(prefix)/share/man
ldapdir    = $(sysconfdir)/ldap
schemadir  = $(ldapdir)/schema
dhcp3dir   = $(sysconfdir)/dhcp3
libdir     = /usr/lib
pkglibdir  = $(libdir)/debian-edu-config
mailcapdir = $(libdir)/mime/packages
vardir     = /var

CFFILES = \
	cf.apache \
	cf.apt \
	cf.bind9 \
	cf.cfengine \
	cf.cups \
	cf.devfsd \
	cf.dhcpserver \
	cf.exim \
	cf.imap \
	cf.homes \
	cf.inetd \
	cf.kdm \
	cf.ldapserver \
	cf.ldapclient \
	cf.locale \
	cf.ltsp \
	cf.fstab \
	cf.mime-support \
	cf.mozilla \
	cf.munin \
	cf.nagios \
	cf.nat \
	cf.ntp \
	cf.opera \
	cf.pcmcia \
	cf.samba \
	cf.slbackup \
	cf.squid \
	cf.ssh \
	cf.syslog \
	cf.sysstat \
	cfd.conf \
	cfengine.conf \
	cf.sarge-installation-cleanup \

CFBINFILES = \
	cfd \
	cfrunhosts.pl

# Files to install in /etc/
SYSCONFFILES = \
	X11/Xsession.d/10debian-edu-one-login-per-host \
	X11/Xsession.d/10debian-edu-set-umask \
	desktop-profiles/debian-edu-config.listing \
	bind/debian-edu/db.10 \
	bind/debian-edu/db.192.168 \
	bind/debian-edu/db.intern \
	bind/debian-edu/named-bind9.conf \
	courier/authldaprc-debian-edu \
	courier/imapd-debian-edu.cnf \
	debian-edu/hd-warn.conf \
	debian-edu/nightkill.conf \
	default/backdoor \
	cfengine/cfservd.conf \
	cfengine/update.conf \
	cfengine/inputs/cfagent.conf \
	cups/cupsd-debian-edu.conf \
	dhclient-exit-hooks \
	dhcp3/dhcpd-debian-edu.conf \
	exim/exim-ldap-client.conf \
	exim/exim-ldap-server.conf \
	exim4/exim-ldap-client-v4.conf \
	exim4/exim-ldap-server-v4.conf \
	filesystems \
	ldap/slapd-debian-edu.conf \
	ldap/slapd-sarge_debian-edu.conf \
	ldap/ssl/slapd-cert.cnf \
	pam.d/common-auth-ldap-debian-edu \
	pam.d/common-account-ldap-debian-edu \
	pam.d/common-password-ldap-debian-edu \
	pam.d/common-session-winbind-debian-edu \
	pam.d/common-account-winbind-debian-edu \
	pam.d/common-auth-winbind-debian-edu \
	pam.d/common-password-winbind-debian-edu \
	pam.d/common-session-debian-edu \
	pam.d/cron-debian-edu \
	pam.d/cupsys-debian-edu \
	pam.d/kde-debian-edu \
	pam.d/kscreensaver-debian-edu \
	pam.d/login-debian-edu \
	pam.d/other-debian-edu \
	pam.d/passwd-debian-edu \
	pam.d/samba-debian-edu \
	pam.d/ssh-debian-edu \
	pam.d/su-debian-edu \
	usbmount/usbmount-debian-edu.conf \
	samba/netlogon/login.bat \
	samba/netlogon/shortcut.vbs \
	samba/smb-debian-edu.conf \
	samba/smb-winbind-debian-edu.conf \
	security/pam_mount-winbind-debian-edu.conf \
	security/pam_mount-stateless-debian-edu.conf \
	krb5-winbind-debian-edu.conf \
	lsb-release \
	nagios/nagios-debian-edu.cfg \
	nagios/debian-edu/checkcommands.cfg \
	nagios/debian-edu/contactgroups.cfg \
	nagios/debian-edu/contacts.cfg \
	nagios/debian-edu/dependencies.cfg \
	nagios/debian-edu/htpasswd.users \
	nagios/debian-edu/index.html \
	nagios/debian-edu/main.html \
	nagios/debian-edu/side.html \
	nagios/debian-edu/misccommands.cfg \
	nagios/debian-edu/resource.cfg \
	nagios/debian-edu/services.cfg \
	nagios/debian-edu/timeperiods.cfg \
	nagios/debian-edu/servicetemplates.cfg \
	nagios/debian-edu/hosttemplates.cfg \
	nagios/debian-edu/skolelinux_logo.png \
	nagios/debian-edu/skolelinux_logo_140.png \
	nagios/debian-edu/hosts/gateway.cfg \
	nagios/debian-edu/hosts/tjener.cfg \
	nagios/debian-edu/hostgroups/gateways.cfg \
	nagios/debian-edu/hostgroups/servers.cfg

LIBFILES = \
	mime/packages/debian-edu-mailcap

SYSCONFSCRIPTS = \
	X11/Xsession-debian-edu \
	samba/smbaddclient.pl

SCHEMAS = \
	samba.schema \
	samba-2.2.x.schema \
	courier.schema \
	automount-debian-edu.schema \
	norEduPerson.schema \
	EduPerson.schema \
	lis.schema

LDIFS = \
	root.ldif \
	autofs.ldif \
	netgroup.ldif

LDAPPROGRAMS = \
	ldappasswd2 \
	ldap2netgroup \
	ldap-debian-edu-install \
	samba-debian-edu-admin \
	mkslapdcert

VARFILES = \
	www/index.html.de \
	www/index.html.en \
	www/index.html.es \
	www/index.html.fr \
	www/index.html.nb \
	www/index.html.nl \
	www/skl-ren_css.css \
	www/logo-trans.png

KIOSKFILES = \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/ScoreReadingTrainer.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/abakus.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/k3dsurf.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kalgebra.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kalzium.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kbruch.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/keduca.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kformula.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kig.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/klatin.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kmplot.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kpercentage.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kregexpeditor.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kstars.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kturtle.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kverbos.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kvoctrain.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/kwordquiz.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/ooo-impress.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/ooo-writer.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/qliss3d.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/apps/kdesktop/Desktop/vym.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/config/kdeglobals \
	share/debian-edu/kde-profile/debian_edu_pupils/share/config/kdesktoprc \
	share/debian-edu/kde-profile/debian_edu_pupils/share/config/konqiconviewrc \
	share/debian-edu/kde-profile/debian_edu_pupils/share/config/uiserverrc \
	share/debian-edu/kde-profile/debian_edu_pupils/share/services/update_ksycoca \
	share/debian-edu/kde-profile/debian_edu_pupils/share/desktop-directories/computer\ science.directory \
	share/debian-edu/kde-profile/debian_edu_pupils/share/desktop-directories/creative\ work.directory \
	share/debian-edu/kde-profile/debian_edu_pupils/share/desktop-directories/languages.directory \
	share/debian-edu/kde-profile/debian_edu_pupils/share/desktop-directories/music.directory \
	share/debian-edu/kde-profile/debian_edu_pupils/share/desktop-directories/writing.directory \
	share/debian-edu/kde-profile/debian_edu_pupils/share/desktop-directories/mathematics.directory \
	share/debian-edu/kde-profile/debian_edu_pupils/share/desktop-directories/science.directory \
	share/debian-edu/kde-profile/debian_edu_pupils/share/config/menus/applications.menu \
	share/debian-edu/kde-profile/debian_edu_pupils/share/config/menus/kde-applications.menu \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/abakus.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/k3dsurf.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kalgebra.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kalzium.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kbruch.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kdissert.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kformula.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/klatin.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kmplot.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kpercentage.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kregexpeditor.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kstars.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kturtle.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kvoctrain.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/kwordquiz.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/oocalc.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/ooimpress.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/oowriter.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/score-reading-trainer.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/qliss3d.desktop \
	share/debian-edu/kde-profile/debian_edu_pupils/share/applications/vym.desktop

all:

install: install-testsuite
	install -d $(DESTDIR)$(bindir)
	install -d $(DESTDIR)$(sbindir)
	install -d $(DESTDIR)$(sysconfdir) $(DESTDIR)$(sysconfdir)/cups
	install -d $(DESTDIR)$(sysconfdir)/exim
	install -d $(DESTDIR)$(sysconfdir)/courier
	install -d $(DESTDIR)$(ldapdir)
	install -d $(DESTDIR)$(dhcp3dir)
	install -d $(DESTDIR)$(mailcapdir)

# program's manpages are autodetected. 
	for prog in $(PROGS); do \
		$(INSTALL) bin/$$prog $(DESTDIR)$(bindir) ; \
		if [ -e "share/man/man1/$$prog.1" ]; \
		then \
		$(INSTALL_DATA) "share/man/man1/$$prog.1" $(DESTDIR)$(mandir)/man1/$$sprog.1 ; \
		fi \
	done
# Using manpages autodetection : 
	for sprog in $(SPROGS); do \
		$(INSTALL) sbin/$$sprog $(DESTDIR)$(sbindir) ; \
		if [ -e "share/man/man8/$$sprog.8" ]; \
		then \
		$(INSTALL_DATA) "share/man/man8/$$sprog.8" $(DESTDIR)$(mandir)/man8/$$sprog.8 ; \
		fi \
	done
	$(INSTALL_DATA) README $(DESTDIR)$(docdir)/README
	for cf in $(CFFILES); do \
		$(INSTALL_DATA) cf/$$cf $(DESTDIR)$(cfdir)/$$cf; \
	done
	for cf in $(CFBINFILES); do \
		$(INSTALL) cf/$$cf $(DESTDIR)$(cfdir)/$$cf; \
	done



	for file in $(SYSCONFFILES) ; do \
		$(INSTALL_DATA) etc/$$file $(DESTDIR)$(sysconfdir)/$$file; \
	done

	mkdir -p $(DESTDIR)$(sysconfdir)/init.d
	for file in $(SYSCONFSCRIPTS) ; do \
		$(INSTALL) etc/$$file $(DESTDIR)$(sysconfdir)/$$file; \
	done

	for file in $(LIBFILES) ; do \
		$(INSTALL_DATA) lib/$$file $(DESTDIR)$(libdir)/$$file; \
	done

	for f in share/debian-edu-config/tools/passwd \
		share/debian-edu-config/tools/adduser \
		share/debian-edu-config/tools/movehome \
		share/debian-edu-config/tools/nightkill.sh \
		share/debian-edu-config/tools/logoutkill.sh \
		share/debian-edu-config/tools/ldap-user-clean-attic.sh \
		share/debian-edu-config/tools/ldapdump.sh \
	; do \
		$(INSTALL) $$f $(DESTDIR)/usr/$$f ; \
	done

	for f in share/debian-edu/common/share/config/kcookiejarrc \
		share/debian-edu/common/share/config/artsmessagerc \
		share/debian-edu/common/share/config/kdeprintrc \
		share/debian-edu/common/share/config/kpersonalizerrc \
		share/debian-edu/common/share/config/konquerorrc \
		share/debian-edu/common/share/mimelnk/applnk/msword.desktop \
		share/debian-edu/networked-kde2/share/config/kioslaverc \
		share/debian-edu/networked-kde3/share/config/kioslaverc \
		share/debian-edu/thin-client/share/config/kcmartsrc \
	; do \
		$(INSTALL_DATA) $$f $(DESTDIR)/usr/$$f ; \
	done

	for f in $(KIOSKFILES) \
	; do \
		$(INSTALL_DATA) $$f $(DESTDIR)/usr/$$f ; \
	done

	for f in share/ltsp/plugins/ltsp-build-client/Debian-custom/025-bootprompt-opts \
	; do \
		$(INSTALL_DATA) $$f $(DESTDIR)/usr/$$f ; \
	done

# Using manpages autodetection : 
	for program in $(LDAPPROGRAMS) ; do \
		$(INSTALL) ldap-tools/$$program $(DESTDIR)$(bindir)/$$program; \
		if [ -e "share/man/man1/$$program.1" ]; \
		then \
		$(INSTALL_DATA) "share/man/man1/$$program.1" $(DESTDIR)$(mandir)/man1/$$sprog.1 ; \
		fi \
	done
	for schema in $(SCHEMAS) ; do \
		$(INSTALL_DATA) ldap-schemas/$$schema $(DESTDIR)$(schemadir)/$$schema;\
	done
	for ldif in $(LDIFS) ; do \
		$(INSTALL_DATA) ldap-bootstrap/$$ldif $(DESTDIR)$(ldapdir)/$$ldif ; \
	done

	for file in $(VARFILES) ; do \
		$(INSTALL_DATA) var/$$file $(DESTDIR)/var/$$file; \
	done

	chmod 700 $(DESTDIR)/var/lib/maildirs/


install-testsuite:
	install -d $(DESTDIR)$(pkglibdir)/testsuite
	for test in testsuite/* ; do \
		$(INSTALL) $$test $(DESTDIR)$(pkglibdir)/$$test; \
	done



clean:
	# Remove CVS cruft
	-find . -name '.#*' | xargs rm

dist:
	debuild -us -uc
