#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
#

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/meta-subst.mk

# work around #262408
DEB_DH_INSTALL_SOURCEDIR := $(DEB_DESTDIR)

SYSCONFDIR = $(DEB_DESTDIR)/etc
CGIDIR = $(DEB_DESTDIR)/usr/lib/cgi-bin
DATADIR = $(DEB_DESTDIR)/usr/share

PKGDATADIR = $(DATADIR)/elho

common-install-indep::
	mkdir -p $(DEB_DESTDIR)

	install --directory $(CGIDIR)
	install --mode=755 ip.cgi $(CGIDIR)

	install --directory $(SYSCONFDIR)/apache2/conf-available
	install --mode=644 --no-target-directory \
		etc/apache2/conf-available/contentsecuritypolicy-init.conf \
		$(SYSCONFDIR)/apache2/conf-available/00-contentsecuritypolicy-init.conf
	for f in contenttypeoptions crosssitescripting default-deny \
		framepolicy logging nobackupfiles nodotfiles noincludes \
		serveradmin ; \
	do \
		install --mode=644 "etc/apache2/conf-available/$$f.conf" \
			$(SYSCONFDIR)/apache2/conf-available ; \
	done
	install --mode=644 --no-target-directory \
		etc/apache2/conf-available/contentsecuritypolicy.conf \
		$(SYSCONFDIR)/apache2/conf-available/zz-contentsecuritypolicy.conf

	install --directory $(PKGDATADIR)/customize
	install --directory $(PKGDATADIR)/customize/etc/apache2/conf-available
	for f in apache2-doc security ; \
	do \
		install --mode=644 "etc/apache2/conf-available/$$f.conf.sed" \
			$(PKGDATADIR)/customize/etc/apache2/conf-available ; \
	done
	install --directory $(PKGDATADIR)/customize/etc/apache2/mods-available
	for f in autoindex deflate dir negotiation ; \
	do \
		install --mode=644 "etc/apache2/mods-available/$$f.conf.sed" \
			$(PKGDATADIR)/customize/etc/apache2/mods-available ; \
	done
	install --directory $(PKGDATADIR)/customize/etc/logrotate.d
	install --mode=644 etc/logrotate.d/apache2.sed \
			$(PKGDATADIR)/customize/etc/logrotate.d
