#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk

# We use the Debian packaged jquery, a symlink is created 
# using debian/simpleid.links
DEB_DH_ALWAYS_EXCLUDE = simpleid/html/jquery.js

DEB_INSTALL_CHANGELOGS_ALL = simpleid/CHANGELOG.txt

SIMPLEID_WEB_CONF = etc/apache2/conf-available/simpleid.conf

binary-install/simpleid::
	echo -n "<?php define('SIMPLEID_VERSION', '"$(DEB_VERSION)"'); ?>" > debian/simpleid/usr/share/simpleid/www/version.inc.php

binary-fixup/simpleid::
	chown root.www-data debian/simpleid/var/lib/simpleid/identities
	chmod 0750 debian/simpleid/var/lib/simpleid/identities
	chown www-data.www-data debian/simpleid/var/lib/simpleid/cache debian/simpleid/var/lib/simpleid/store
	chmod 0770 debian/simpleid/var/lib/simpleid/cache debian/simpleid/var/lib/simpleid/store
	dh_apache2
	echo '<Directory "/usr/share/simpleid/www">' >> debian/simpleid/$(SIMPLEID_WEB_CONF)
	cat simpleid/www/.htaccess.dist >> debian/simpleid/$(SIMPLEID_WEB_CONF)
	echo '</Directory>' >> debian/simpleid/$(SIMPLEID_WEB_CONF)
	rm debian/simpleid/usr/share/simpleid/www/.htaccess.dist

