PACKAGE = debian-edu-config

PROGS = \
	debian-edu-current-codename \
	debian-edu-ldapserver \
	debconf-set-selections-edu \
	ltsp-arch-debian-edu \
	update-ini-file

SPROGS = cfengine-debian-edu \
	debian-edu-fsautoresize \
	debian-edu-hd-warn \
	debian-edu-hwsetup \
	debian-edu-ltsp \
	debian-edu-ltsp-audiodivert \
	debian-edu-nscd-netgroup-cache \
	debian-edu-pxeinstall \
	debian-edu-restart-services \
	debian-edu-test-install \
	debian-edu-update-netblock \
	snakeoil-on-ice \
	update-hostname-from-ip

INSTALL     = install -D -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
gosadir    = $(sysconfdir)/gosa
ldapdir    = $(sysconfdir)/ldap
slbackupphpdir = $(sysconfdir)/slbackup-php
schemadir  = $(ldapdir)/schema
dhcpdir   = $(sysconfdir)/dhcp
libdir     = /usr/lib
pkglibdir  = $(libdir)/debian-edu-config
mailcapdir = $(libdir)/mime/packages
vardir     = /var
wwwdir     = /etc/debian-edu/www


CFFILES = \
	cf.adduser \
	cf.apache2 \
	cf.apt \
	cf.cfengine \
	cf.cups \
	cf.dhcpserver \
	cf.exim \
	cf.imap \
	cf.homes \
	cf.firefox-esr \
	cf.inetd \
	cf.kdm \
	cf.krb5client \
	cf.ldapserver \
	cf.ldapclient \
	cf.bind \
	cf.ltsp \
	cf.pxeinstall \
	cf.fstab \
	cf.nagios3 \
	cf.ntp \
	cf.samba \
	cf.squid \
	cf.syslog \
	cf.sysstat \
	cf.testsetup \
	cf.ldap2zone \
	cfd.conf \
	cfengine.conf

CFBINFILES = \
	cfd \
	cfrunhosts.pl

# Files to install in /etc/
SYSCONFFILES = \
	asound.conf \
	apt/apt.conf.d/90squid \
	apt/apt.conf.d/99-edu-prefer-firefox \
	bind/named.conf.ldap2zone \
	bind/db.intern \
	bind/db.10.in-addr.arpa. \
	bind/db.subnet00.intern. \
	bind/db.subnet01.intern. \
	bind/db.0.168.192.in-addr.arpa. \
	bind/db.1.168.192.in-addr.arpa. \
	X11/Xsession.d/05debian-edu-truncate-xerrorlog \
	X11/Xsession.d/06debian-edu-firefox-ltsp \
	X11/Xsession.d/09debian-edu-missing-home \
	X11/Xsession.d/10debian-edu-one-login-per-host \
	desktop-profiles/debian-edu-config.listing \
	debian-edu/hd-warn.conf \
	debian-edu/nightkill.conf \
	default/munin-node \
	cfengine/cfservd.conf \
	cfengine/update.conf \
	cfengine/inputs/cfagent.conf \
	cups/cupsd-debian-edu.conf \
	dhcp/dhclient-exit-hooks.d/autofs-reload \
	dhcp/dhclient-exit-hooks.d/wpad-proxy-update \
	dhcp/dhclient-exit-hooks.d/fetch-ldap-cert \
	dhcp/dhclient-exit-hooks.d/hostname \
	dhcp/dhcpd-debian-edu.conf \
	dhcp/dhclient-debian-edu.conf \
	dovecot/local.conf \
	exim4/exim-ldap-client-v4.conf \
	exim4/exim-ldap-server-v4.conf \
	filesystems \
	firefox-esr/debian-edu.js \
	gosa/gosa.conf \
	php5/apache2/php-debian-edu.ini \
	insserv/overrides/kdm \
	insserv/overrides/ntp \
	ldap/rootDSE-debian-edu.ldif \
	ldap/slapd-squeeze_debian-edu.conf \
	ldap/ssl/slapd-cert.cnf \
	samba/netlogon/1stlogon/1stlogon.bat \
	samba/netlogon/config/get_time.bat \
	samba/netlogon/config/penguin.bat \
	samba/netlogon/config/setglobals.bat \
	samba/netlogon/config/standarddrives-students.bat \
	samba/netlogon/config/standarddrives-teachers.bat \
	samba/netlogon/debian-edu-login.bat \
	samba/netlogon/_default_/default.bat \
	samba/netlogon/install/shortcut.vbs \
	samba/netlogon/logon-admins.bat \
	samba/netlogon/logon-jradmins.bat \
	samba/netlogon/logon-students.bat \
	samba/netlogon/logon-teachers.bat \
	samba/netlogon/mozilla/firefox/prefs.js \
	samba/netlogon/mozilla/mkmozapd.bat \
	samba/netlogon/mozilla/profiles.ini.FIREFOX \
	samba/netlogon/mozilla/profiles.ini.THUNDERBIRD \
	samba/netlogon/registry/proxy-ie/proxy-settings-hkcu.reg \
	samba/netlogon/win7+samba_domain-membership/DownloadWinRessourceKits.bat \
	samba/netlogon/win7+samba_domain-membership/README_Win7-Domain-Membership.txt \
	samba/netlogon/win7+samba_domain-membership/SeSystemTimePrivilege.bat \
	samba/netlogon/win7+samba_domain-membership/Win7_Samba3DomainMember.reg \
	samba/smb-debian-edu-client.conf \
	samba/smb-debian-edu.conf \
	samba/smb-winbind-debian-edu.conf \
	samba/samba-domain-policy.ldif \
	security/pam_mount-winbind-debian-edu.conf \
	security/pam_mount-stateless-debian-edu.conf \
	slbackup-php/config.php \
	smbldap-tools/smbldap_bind.conf \
	smbldap-tools/smbldap.conf \
	sssd/sssd-debian-edu.conf \
	xdg/autostart/welcome-webpage.desktop \
	lsb-release \
	apache2/mods-available/debian-edu-userdir.conf \
	apache2/sites-available/debian-edu-default.conf \
	apache2/sites-available/debian-edu-ssl-default.conf \
	apache2/conf-available/debian-edu-config-doc.conf \
	nagios3/debian-edu/cgi.cfg \
	nagios3/debian-edu/commands.cfg \
	nagios3/debian-edu/contactgroups.cfg \
	nagios3/debian-edu/contacts.cfg \
	nagios3/debian-edu/dependencies.cfg \
	nagios3/debian-edu/htpasswd.users \
	nagios3/debian-edu/escalations.cfg \
	nagios3/debian-edu/hostextinfo.cfg \
	nagios3/debian-edu/hostgroups.cfg \
	nagios3/debian-edu/hosts.cfg \
	nagios3/debian-edu/host_templates.cfg \
	nagios3/debian-edu/nagios.cfg \
	nagios3/debian-edu/resources.cfg \
	nagios3/debian-edu/serviceextinfo.cfg \
	nagios3/debian-edu/servicegroups.cfg \
	nagios3/debian-edu/services.cfg \
	nagios3/debian-edu/service_templates.cfg \
	nagios3/debian-edu/timeperiods.cfg \
	munin/debian-edu-munin-node.conf \
	polkit-1/localauthority.conf.d/80-edu-admin.conf \
	dbus-1/system.d/hal-debian-edu.conf \
	nbd-server/conf.d/debian-edu.conf

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

SYSCONFSCRIPTS = \
	ltspfs/mounter.d/edu-notify \
	mklocaluser.d/20-debian-edu-config \
	NetworkManager/dispatcher.d/02debian-edu-config \
	shutdown-at-night/clients-generator \
	resolvconf/update.d/bind-debian-edu \
	resolvconf/update.d/ltsp-chroots \
	wicd/scripts/preconnect/set_wireless_mac_from_eth0 \
	X11/Xsession-debian-edu \
	samba/smbaddclient.sh \
	samba/smbldap-machineadd-gosa

SCHEMAS = \
	samba.schema \
	dhcp.schema \
	dnsdomainaux.schema \
	ltspclientaux.schema \
	eduorg-200210-openldap.schema \
	eduperson-200806-openldap.schema \
	kerberos.schema \
	noreduperson-1.5-openldap.schema \
	samba3.schema \
	sudo.schema \
	trust.schema \
	gosystem.schema \
	gofon.schema \
	goto.schema \
	gosa-samba3.schema \
	gofax.schema \
	goserver.schema \
	goto-mime.schema

LDIFS = \
	root.ldif \
	autofs.ldif \
	firstuser.ldif \
	ipnetworks.ldif \
	netgroup.ldif \
	samba.ldif \
	sudo.ldif \
	krb5.ldif \
	ltsp.ldif \
	gosa.ldif \
	gosa-server.ldif

LDAPPROGRAMS = \
	ldap-add-host-to-netgroup \
	ldap-add-user-to-group \
	ldap-createuser-krb5 \
	ldappasswd2 \
	ldap2netgroup \
	ldap-debian-edu-install \
	ldap-server-getcert \
	mkslapdcert \
	sitesummary2ldapdhcp

WWWFILES = \
	index.html.ca \
	index.html.da \
	index.html.de \
	index.html.en \
	index.html.es \
	index.html.fr \
	index.html.id \
	index.html.it \
	index.html.ja \
	index.html.nb \
	index.html.nl \
	index.html.pt \
	index.html.pt_BR \
	index.html.ro \
	index.html.ru \
	index.html.zh \
	skl-ren_css.css \
	logo-trans.png \
	wpad.dat

KIOSKFILES = \
	share/debian-edu/students/share/apps/kdesktop/Desktop/kalzium.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/chguserpw.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/kmplot.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/kstars.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/ooo-impress.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/ooo-writer.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/gcompris.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/gimp-2.2.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/kgeography.desktop \
	share/debian-edu/students/share/apps/kdesktop/Desktop/stopmotion.desktop \
	share/debian-edu/students/share/config/kdeglobals \
	share/debian-edu/students/share/config/konqiconviewrc \
	share/debian-edu/students/share/config/uiserverrc \
	share/debian-edu/students/share/services/update_ksycoca \
	share/debian-edu/students/share/config/menus/applications.menu \
	share/debian-edu/students/share/config/menus/kde-applications.menu \
	share/debian-edu/students/share/applications/kalzium.desktop \
	share/debian-edu/students/share/applications/kbruch.desktop \
	share/debian-edu/students/share/applications/klatin.desktop \
	share/debian-edu/students/share/applications/kmplot.desktop \
	share/debian-edu/students/share/applications/kpercentage.desktop \
	share/debian-edu/students/share/applications/kstars.desktop \
	share/debian-edu/students/share/applications/kturtle.desktop \
	share/debian-edu/students/share/applications/kvoctrain.desktop \
	share/debian-edu/students/share/applications/kwordquiz.desktop \
	share/debian-edu/students/share/applications/oocalc.desktop \
	share/debian-edu/students/share/applications/ooimpress.desktop \
	share/debian-edu/students/share/applications/oowriter.desktop  \
	share/debian-edu/root/share/apps/kdesktop/Desktop/tjener.desktop

all:
	$(MAKE) -C www

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

# program's manpages are autodetected. 
	set -e ; 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 : 
	set -e ; 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

# Samba roaming profile examples in different languages
	set -e ; for l in en de nb; do \
	$(INSTALL_DATA) doc/examples/smb-roaming-profiles-$$l.conf \
	$(DESTDIR)$(docdir)/examples/smb-roaming-profiles-$$l.conf ; \
	done

	set -e ; for cf in $(CFFILES); do \
		$(INSTALL_DATA) cf/$$cf $(DESTDIR)$(cfdir)/$$cf; \
	done
	set -e ; for cf in $(CFBINFILES); do \
		$(INSTALL) cf/$$cf $(DESTDIR)$(cfdir)/$$cf; \
	done

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

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

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

	set -e ; for f in \
		share/debian-edu-config/d-i/finish-install \
		share/debian-edu-config/d-i/pre-pkgsel \
		share/debian-edu-config/tools/passwd \
		share/debian-edu-config/tools/cups-queue-autoflush \
		share/debian-edu-config/tools/cups-queue-autoreenable \
		share/debian-edu-config/tools/debian-edu-bless \
		share/debian-edu-config/tools/debian-edu-winbind \
		share/debian-edu-config/tools/get-default-homepage \
		share/debian-edu-config/tools/gosa-create \
		share/debian-edu-config/tools/gosa-create-host \
		share/debian-edu-config/tools/gosa-lock-user \
		share/debian-edu-config/tools/gosa-remove \
		share/debian-edu-config/tools/gosa-sync \
		share/debian-edu-config/tools/gosa-sync-dns-nfs \
		share/debian-edu-config/tools/gosa-unlock-user \
		share/debian-edu-config/tools/firefox-plugin-support \
		share/debian-edu-config/tools/kerberos-kdc-init \
		share/debian-edu-config/tools/ldap2bind-updatezonelist \
		share/debian-edu-config/tools/ldap-user-clean-attic.sh \
		share/debian-edu-config/tools/ldapdump.sh \
		share/debian-edu-config/tools/locate-syslog-collector \
		share/debian-edu-config/tools/logoutkill.sh \
		share/debian-edu-config/tools/ltsp-addfirmware \
		share/debian-edu-config/tools/ltsp-update-resolvconf \
		share/debian-edu-config/tools/missing-desktop-file \
		share/debian-edu-config/tools/movehome \
		share/debian-edu-config/tools/nbdquery \
		share/debian-edu-config/tools/nbdswap-cleanup \
		share/debian-edu-config/tools/nightkill.sh \
		share/debian-edu-config/tools/notify-local-users \
		share/debian-edu-config/tools/package-disk-usage \
		share/debian-edu-config/tools/password-fix-squeeze-r0 \
		share/debian-edu-config/tools/pipegraph \
		share/debian-edu-config/tools/preseed-ldap-kerberos \
		share/debian-edu-config/tools/preseed-sitesummary \
		share/debian-edu-config/tools/pxe-addfirmware \
		share/debian-edu-config/tools/qemu-test-network \
		share/debian-edu-config/tools/run-at-firstboot \
		share/debian-edu-config/tools/setup-ad-client \
		share/debian-edu-config/tools/setup-roaming \
		share/debian-edu-config/tools/show-welcome-webpage \
		share/debian-edu-config/tools/sssd-generate-config \
		share/debian-edu-config/tools/squid-update-cachedir \
		share/debian-edu-config/tools/subnet-change \
		share/debian-edu-config/tools/update-firefox-homepage \
		share/debian-edu-config/tools/update-proxy-from-wpad \
		share/debian-edu-config/tools/workaround-udev-bug-765577 \
		share/debian-edu-config/tools/wpad-extract \
		share/debian-edu-config/tools/debian-edu-dovecot-create-cert \
		share/debian-edu-config/tools/migrate-squid-to-squid3 \
		share/debian-edu-config/ltspfs-mounter-kde \
		share/ltsp/get-ldap-ltsp-config \
		share/ltsp/init-ltsp.d/08-edu-hostname \
		share/ltsp/init-ltsp.d/60-edu-client \
		share/ltsp/init-ltsp.d/70-edu-client-core \
		share/initramfs-tools/scripts/nfs-bottom/before-ltsp \
	; do \
		$(INSTALL) $$f $(DESTDIR)/usr/$$f ; \
	done

	set -e ; for f in share/debian-edu/common/share/config/kcookiejarrc \
		share/debian-edu/common/share/apps/kicker/default-apps \
		share/debian-edu/common/share/config/artsmessagerc \
		share/debian-edu/common/share/config/kdeglobals \
		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/config/kickoffrc \
		share/debian-edu/common/share/config/nepomukserverrc \
		share/debian-edu/networked-kde3/share/config/kioslaverc \
		share/debian-edu/networked-kde3/share/config/adept_notifierrc \
		share/debian-edu/networked-kde3/share/config/networkmanagementrc \
		share/debian-edu/thin-client/share/config/kcmartsrc \
	; do \
		$(INSTALL_DATA) $$f $(DESTDIR)/usr/$$f ; \
	done

	set -e ; for f in $(KIOSKFILES) ; do \
		$(INSTALL_DATA) "$$f" "$(DESTDIR)/usr/$$f" ; \
	done

	set -e ; for f in \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/000-arch-detection \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/000-default-dist \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/002-default-apt-keyring \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/010-set-resolver \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/011-http-nopipeline \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/015-edu-apt-source \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/020-rootpath \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/025-bootprompt-opts \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/032-edu-pkgs \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/045-remove-udev-net-rules \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/050-nbdquery \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/080-eatmydata \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/095-umount-error \
 share/ltsp/plugins/ltsp-build-client/Debian-custom/098-etckeeper \
	; do \
		$(INSTALL_DATA) $$f $(DESTDIR)/usr/$$f ; \
	done

	$(INSTALL_DATA) sbin/debian-edu-fsautoresizetab $(DESTDIR)/usr/share/debian-edu-config/fsautoresizetab

	set -e ; for f in \
		share/debian-edu-config/rsyslog-collector \
		share/debian-edu-config/firefox-networked-prefs.js \
		share/debian-edu-config/squid3.conf \
		share/pam-configs/edu-group \
		share/pam-configs/edu-umask \
		share/perl5/Debian/Edu.pm \
		share/debian-edu-config/pam-config-ccreds-check \
		share/debian-edu-config/pam-config-ccreds-save \
		share/debian-edu-config/pam-config-mkhomedir \
		share/debian-edu-config/pam-config-nopwdchange \
		share/debian-edu-config/pam-nopwdchange.py \
	; do \
		$(INSTALL_DATA) $$f $(DESTDIR)/usr/$$f ; \
	done

# Using manpages autodetection : 
	set -e ; 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
	set -e ; for schema in $(SCHEMAS) ; do \
		$(INSTALL_DATA) ldap-schemas/$$schema $(DESTDIR)$(schemadir)/$$schema;\
	done
	set -e ; for ldif in $(LDIFS) ; do \
		$(INSTALL_DATA) ldap-bootstrap/$$ldif $(DESTDIR)$(ldapdir)/$$ldif ; \
	done

	set -e ; for file in $(WWWFILES) ; do \
		$(INSTALL_DATA) www/$$file $(DESTDIR)/$(wwwdir)/$$file ; \
	done

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

install-testsuite:
	set -e ; for f in \
		share/debian-edu-config/testsuite-lib.sh \
	; do \
		$(INSTALL_DATA) $$f $(DESTDIR)/usr/$$f ; \
	done

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



clean:
	$(MAKE) -C www $@

dist:
	debuild -us -uc

status:
	$(MAKE) -C www stats

i18n-poke:
	podebconf-report-po
	podebconf-report-po --podir www
