#!/usr/bin/make -f
# GNU Copyright @ 2001 - 2008 Lars Bahner
# GNU copyright 1997 to 1999 by Joey Hess.

export PACKAGE=pyca


configure: 

	dh_testdir


build-arch: build
build-indep: build

build: configure

clean:

	dh_testdir
	dh_testroot

	rm -f httpd_error_log ca-certreq-mail.out

	dh_clean

install: build

	dh_testdir
	dh_testroot
	dh_installdirs

	touch httpd_error_log
	touch ca-certreq-mail.out

	cp -r bin/* debian/pyca/usr/bin
	cp -r sbin/* debian/pyca/usr/sbin
	cp -r cgi-bin/* debian/pyca/usr/lib/cgi-bin/pyca
	cp -r conf/* debian/pyca/etc/pyca
	cp -r pylib/* debian/pyca/usr/share/pyca/pylib

	install -o root -g www-data -m 620 httpd_error_log debian/pyca/var/log/pyca/httpd_error_log
	install -o root -g nogroup -m 620 ca-certreq-mail.out debian/pyca/var/log/pyca/ca-certreq-mail.out
	install -o root -g root -m 644 debian/pyca.logrotate debian/pyca/etc/logrotate.d/pyca

	chmod 644 debian/pyca/usr/lib/cgi-bin/pyca/pycacnf.py

binary-arch: build install

binary-indep: build install

	dh_testdir
	dh_testroot
	dh_installdocs htdocs debian/crontab.sample
	cat debian/index.html > debian/pyca/usr/share/doc/pyca/htdocs/index.html
	dh_installman --language=C debian/*.1 debian/*.8
	dh_installchangelogs 
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep

.PHONY: build clean binary-indep binary install configure
