summaryrefslogtreecommitdiff
blob: de033ef91b79e19aa6043ccd062dae0c35c29129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=5

if [[ ${PV} == *9999* ]]; then
	CVS_ECLASS="cvs "
	ECVS_SERVER="cvs.savannah.nongnu.org:/sources/phamm"
	ECVS_MODULE="phamm05"
	S="${WORKDIR}/phamm05"
	KEYWORDS=""
else
	RELEASE_URI="http://open.rhx.it/${PN}/${P}.tar.gz"
	KEYWORDS="~amd64"
fi

inherit ${CVS_ECLASS} webapp

DESCRIPTION="PHP LDAP Virtual Hosting Manager"
HOMEPAGE="http://www.phamm.org/"

SRC_URI="
	${RELEASE_URI}
	amavis? ( http://www.ijs.si/software/amavisd/LDAP.schema.txt -> amavisd-new.schema )
	ftp? ( http://open.rhx.it/phamm/schema/pureftpd.schema -> pureftpd-phamm.schema )
	radius? ( http://open.rhx.it/phamm/schema/radius.schema -> radius-phamm.schema )
	samba? ( http://open.rhx.it/phamm/schema/samba.schema -> samba-phamm.schema )
"
LICENSE="
	GPL-2
	amavis? ( FDL-1.2 )
	ftp? ( BSD )
	radius? ( public-domain )
	samba? ( GPL-3 )
"

IUSE="amavis ftp radius samba"
DEPEND="dev-lang/php:=[ldap,xml]"
RDEPEND="${DEPEND}"

pkg_setup() {
	webapp_pkg_setup
}

src_unpack() {
	if [[ ${PV} == *9999* ]]; then
		cvs_src_unpack
	else
		default
	fi
}

src_install() {

	# Remove CVS subdirs
	[[ ${PV} == *9999* ]] && ecvs_clean

	# Install docs
	local DOCS="CHANGELOG COPYRIGHT INSTALL LIB_FUNCTIONS
		PHAMM-LOGO-USE.POLICY README README.locales README.PLUGINS THANKS TODO"
	dodoc ${DOCS} || die "Failed to install Documentation files."

	webapp_src_preinst

	# Install base examples, schema and docs files
	insinto "/usr/share/doc/${PF}"
	doins -r "${S}/examples" || die "Failed to install examples."
	doins -r "${S}/schema" || die "Failed to install schemas."
	doins -r "${S}/docs" || die "Failed to install docs."

	# Install extra schema files
	insinto "/usr/share/doc/${PF}/schema"
	if use amavis; then doins "${DISTDIR}/amavisd-new.schema" || die "Failed to install amavisd-new schema." ; fi
	if use ftp; then doins "${DISTDIR}/pureftpd-phamm.schema" || die "Failed to install pureftpd schema." ; fi
	if use radius; then doins "${DISTDIR}/radius-phamm.schema" || die "Failed to install radius schema." ; fi
	if use samba; then doins "${DISTDIR}/samba-phamm.schema" || die "Failed to install samba schema." ; fi

	# Install the package
	insinto "${MY_HTDOCSDIR}"
	doins *.php || die "Failed to copy php files."

	if [[ ${PV} == *9999* ]]; then
		newins config.inc.example.php config.inc.php || die "Failed to copy default config file."
	fi

	doins -r DTD || die "Failed to install the DTD dir."
	doins -r lib || die "Failed to install the lib dir."
	doins -r locales || die "Failed to install the locales dir."
	doins -r plugins || die "Failed to install the plugins dir."
	doins -r po || die "Failed to install the po dir."
	doins -r tools || die "Failed to install the tools dir."
	doins -r www-data || die "Failed to install the www-data dir."

	# Protect config files
	webapp_configfile ${MY_HTDOCSDIR}/config.inc.php
	for file in plugins/*; do
		webapp_configfile ${MY_HTDOCSDIR}/${file}
	done

	webapp_src_install
}