summaryrefslogtreecommitdiff
blob: 4bee1d04d9d5f8e00eaa6f7c5d7d53caeb2a5743 (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
102
103
104
105
106
107
108
109
110
111
112
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-zope/zopex3/zopex3-3.0.0.ebuild,v 1.6 2005/10/18 16:49:58 mr_bones_ Exp $

inherit eutils

MYPN="ZopeX3"

DESCRIPTION="Zope is a web application platform used for building high-performance, dynamic web sites."
HOMEPAGE="http://www.zope.org"
SRC_URI="http://www.zope.org/Products/${MYPN}/${PV}final/${MYPN}-${PV}.tgz"
LICENSE="ZPL"
SLOT="${PV}"
IUSE=""

KEYWORDS="x86 ~ppc ~amd64"

RDEPEND="=dev-lang/python-2.3*"
python='python2.3'

DEPEND="${RDEPEND}
virtual/libc
>=sys-apps/sed-4.0.5"

S="${WORKDIR}/${MYPN}-${PV}"
ZS_DIR=${ROOT%/}/usr/lib
ZSERVDIR=${ZS_DIR}/${PN}-${PV}
ZSKELDIR=${ZSERVDIR}/zopeskel
ZINSTDIR=/var/lib/zope/${PN}

src_unpack() {
	unpack ${A}
	cd ${S}
}

src_compile() {
	./configure --prefix=${D}${ZSERVDIR} --with-python=/usr/bin/python2.3 || die "Failed to configure."
	emake || die "Failed to compile."
}

src_install() {

	dodoc README.txt
	dodoc ZopeX3/doc/*.txt
	docinto schema
	dodoc ZopeX3/doc/schema/*
	docinto security
	dodoc ZopeX3/doc/security/*
	docinto skins
	dodoc ZopeX3/doc/skins/*
	docinto style
	dodoc ZopeX3/doc/style/*
	docinto zcml
	dodoc ZopeX3/doc/zcml/*

	make install prefix=${D}${ZSERVDIR}

	dosym ../../share/doc/${PF} ${ZSERVDIR}/doc

	# copy the init script skeleton to zopeskel directory of our installation
	cp ${FILESDIR}/zope.initd ${D}${ZSKELDIR}/zope.initd
}

pkg_postinst() {

	einfo
	einfo "This release ($PN) can create default instance using command: ebuild  --config =${PV}"
	einfo
}

pkg_prerm() {

	find ${ZSERVDIR}/lib/python -name \*.py[co] -exec rm -f {} \;
}

pkg_postrm() {

	rmdir /usr/lib/${ZSERVDIR} 2>/dev/null
}

pkg_config() {

	if [ -f /etc/init.d/${PN} -o -d ${ZINSTDIR} ]
	then
		ewarn "Default instance already exists, aborting.."
		ewarn "Please delete first /etc/init.d/${PN} and ${ZINSTDIR}"
		die "Failed to create default instance."
	fi

	${ZSERVDIR}/bin/mkzopeinstance -d ${ZINSTDIR} -u admin:admin
	mkdir -p ${ZINSTDIR}

	# remove unnecessary zope.initd
	rm -f ${ZINSTDIR}/zope.initd

	# log symlink
	rm -rf ${ZINSTDIR}/log
	mkdir -p /var/log/zope/${PN}
	ln -s /var/log/zope/${PN} ${ZINSTDIR}/log

	# draconian permissions :)
	chmod go-rwx -R ${ZINSTDIR}

	cp ${ZSKELDIR}/zope.initd /etc/init.d/${PN}
	chmod 755 /etc/init.d/${PN}
	sed -i -e "s|INSTANCE_HOME|${ZINSTDIR}|" /etc/init.d/${PN}

	einfo "Default instance created at ${ZINSTDIR}"
	einfo "Created default user 'admin' with password 'admin'."
	einfo "Be warned that this instance is prepared to run as root only."
	einfo "To start instance (ports 8080,8021,) use: /etc/init.d/${PN} start"
}