#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=3

build: 
	dh_testdir
	# Nothing to do

clean:
	dh_testdir
	dh_testroot
	dh_clean

# Build architecture-independent files here.
binary-indep: build 
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build 
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	cp -a `ls | grep -v debian | grep -v docs | grep -v INSTALL | grep -v README | grep -v COPYING` debian/nocc/var/www/nocc
	dh_installdocs 
	dh_installchangelogs 

	dh_fixperms
	# Set files ownership to www-data
	chown -R www-data:www-data debian/nocc/var/www/nocc/tmp/
	chown -R www-data:www-data debian/nocc/var/www/nocc/profiles/
	# Set directoy permissions
	chmod -R 755 `find debian/nocc/var/www/nocc/ -type d`
	# Set other files permissions
	chmod -R 644 `find debian/nocc/var/www/nocc/ -type f`
	# Make scripts excutable:
	chmod 755 debian/nocc/var/www/nocc/addcgipath.sh

	dh_compress
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
