#! /bin/sh
#
# $Id$
#
# Parse all template files and expand them into real files
# Roland Mas, debian-sf (Sourceforge for Debian)
#
# For apache2 we have to remove the Listen 80 directive 
# This is to test if apache2 is started and listen on port 80
#
[ -f /etc/default/apache2 ] && . /etc/default/apache2
if [ "x$NO_START" = "x0" ]
then
	/usr/lib/gforge/bin/setup -fhs -noapache -dovhost -system pgsql -nolisten80
else
	/usr/lib/gforge/bin/setup -fhs -noapache -dovhost -system pgsql -listen80
fi	

[ -f /etc/gforge/local.inc ] && chmod 644 /etc/gforge/local.inc
[ -f /etc/gforge/httpd.conf ] && chmod 644 /etc/gforge/httpd.conf

[ -f /etc/gforge/database.inc ] && chown gforge:gforge /etc/gforge/database.inc
[ -f /etc/gforge/database.inc ] && chmod 640 /etc/gforge/database.inc

[ -f /etc/gforge/local.pl ] && chown gforge:gforge /etc/gforge/local.pl
[ -f /etc/gforge/local.pl ] && chmod 640 /etc/gforge/local.pl

[ -f /etc/gforge/templates/httpd.conf.template ] && rm -f /etc/gforge/templates/*.template || true
