# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# Maintainer: Don Seiler <rizzo@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/net-www/phpwebsite/phpwebsite-0.9.3_p1.ebuild,v 1.2 2003/09/06 02:05:10 msterret Exp $


HOSTNAME=`hostname`
DESCRIPTION="phpWebSite provides a complete web site content management system. Web-based administration allows for easy maintenance of interactive, community-driven web sites."
HOMEPAGE="http://phpwebsite.appstate.edu"
MY_PV="${PV/_p/-}"
S="${WORKDIR}/${PN}-${MY_PV}-full"
SRC_URI="mirror://sourceforge/phpwebsite/${PN}-${MY_PV}-full.tar.gz"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~x86 ~ppc ~sparc ~alpha"

DEPEND="virtual/php"

HTTPD_ROOT="`grep '^DocumentRoot' /etc/apache/conf/apache.conf | cut -d\  -f2`"
[ -z "${HTTPD_ROOT}" ] && HTTPD_ROOT="`grep '^DocumentRoot' /etc/apache2/conf/apache.conf | cut -d\  -f2`"
[ -z "${HTTPD_ROOT}" ] && HTTPD_ROOT="/home/httpd/htdocs"
HTTPD_USER="apache"
HTTPD_GROUP="apache"

src_unpack() {
	unpack ${A}
	cd ${S}/setup
	cp ${FILESDIR}/update.php-${PV} .
}

src_install() {
	cd ${S}
	dodir ${HTTPD_ROOT}/phpwebsite
	cp -r * ${D}/${HTTPD_ROOT}/phpwebsite
}

pkg_postinst() {
	einfo
	einfo "You will need to create a database for phpWebSite"
	einfo "on your own before starting setup.  You will also need"
	einfo "to run:"
	einfo
	einfo "cd ${HTTPD_ROOT}/phpwebsite/setup"
	einfo "./secure_setup.sh setup"
	einfo
	einfo "Once you have a database ready proceed to"
	einfo "http://$HOSTNAME/phpwebsite to continue installation."
	einfo
	einfo "Once you are done with installation you need to run"
	einfo
	einfo "cd ${HTTPD_ROOT}/phpwebsite/setup"
	einfo "./secure_phpws.sh run apache users"
	einfo
}