# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../phppgadmin/phppgadmin.conf
# Copyright (C) 2004 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---

# use the php prefix
pkgprefix -t php
prefix=$( pkgprefix php )
set_confopt

makeopt=''
makeinstopt=''

hook_add postmake 5 'phppgadmin_install'
hook_add postdoc  5 'phppgadmin_installconf'

phppgadmin_install() {
	local x="phpPgAdmin"

	mkdir -vp $datadir/$x
	mkdir -vp $sysconfdir/$x

	# if $x/conf exists it's not overwritten, a new link is created
	# inside, i.e. $x/conf/$x -> .
	# ( /me hates these stupid behavior of ln )
	if [ ! -e $datadir/$x/conf ]; then
		ln -vfs $sysconfdir/$x $datadir/$x/conf
	fi

	# phpPgAdmin/conf/config.inc.php excluded, template can be
	# found at phpPgAdmin/conf/config.inc.php-dist
	rm -f conf/config.inc.php
	tar -c * | tar -x -v -C $datadir/$x
}
phppgadmin_installconf() {
	local x="phpPgAdmin"

	cat <<- EOT > $sysconfdir/$x.conf-dist
		Alias /$x $datadir/$x
		<Directory $datadir/$x>
			DirectoryIndex index.php
		</Directory>
	EOT
}