228
|
1 # Copyright 1999-2010 Gentoo Foundation
|
|
2 # Distributed under the terms of the GNU General Public License v2
|
|
3 # $Header: $
|
|
4
|
|
5 EAPI="2"
|
|
6
|
|
7 inherit eutils java-utils-2
|
|
8
|
|
9 MY_PN="${PN/apache-/}"
|
|
10 MY_P="${MY_PN}-${PV}"
|
|
11
|
286
|
12 DESCRIPTION="ZooKeeper is a high-performance coordination service for distributed applications."
|
|
13 HOMEPAGE="http://zookeeper.apache.org/"
|
|
14 SRC_URI="mirror://apache/${MY_PN}/${MY_P}/${MY_P}.tar.gz"
|
228
|
15
|
|
16 LICENSE="Apache-2.0"
|
|
17 SLOT="0"
|
|
18 KEYWORDS="~amd64 ~x86"
|
|
19 RESTRICT="mirror binchecks"
|
|
20 IUSE=""
|
|
21
|
|
22 DEPEND=""
|
|
23 RDEPEND=">=virtual/jre-1.6"
|
|
24
|
|
25 S="${WORKDIR}/${MY_P}"
|
|
26 INSTALL_DIR=/opt/"${PN}"
|
|
27 DATA_DIR=/var/db/"${PN}"
|
|
28 export CONFIG_PROTECT="${CONFIG_PROTECT} ${INSTALL_DIR}/conf"
|
|
29
|
|
30 src_install() {
|
|
31 dodir "${DATA_DIR}"
|
|
32 sed "s:^dataDir=.*:dataDir=${DATA_DIR}:" conf/zoo_sample.cfg > conf/zoo.cfg || die "sed failed"
|
|
33
|
|
34 dodir "${INSTALL_DIR}"
|
|
35 mv "${S}"/* "${D}${INSTALL_DIR}" || die "install failed"
|
|
36
|
|
37 # env file
|
|
38 cat > 99"${PN}" <<-EOF
|
|
39 PATH=${INSTALL_DIR}/bin
|
|
40 CONFIG_PROTECT=${INSTALL_DIR}/conf
|
|
41 EOF
|
|
42 doenvd 99"${PN}" || die "doenvd failed"
|
|
43
|
|
44 cat > "${PN}" <<-EOF
|
|
45 #!/sbin/runscript
|
|
46
|
|
47 opts="start stop restart"
|
|
48
|
|
49 start() {
|
|
50 ${INSTALL_DIR}/bin/zkServer.sh start > /dev/null
|
|
51 }
|
|
52
|
|
53 stop() {
|
|
54 ${INSTALL_DIR}/bin/zkServer.sh stop
|
|
55 }
|
|
56
|
|
57 restart() {
|
|
58 ${INSTALL_DIR}/bin/zkServer.sh restart > /dev/null
|
|
59 }
|
|
60
|
|
61 status() {
|
|
62 ${INSTALL_DIR}/bin/zkServer.sh status
|
|
63 }
|
|
64 EOF
|
|
65 doinitd "${PN}" || die "doinitd failed"
|
|
66 }
|
|
67
|
|
68 pkg_postinst() {
|
|
69 elog "For info on configuration see http://hadoop.apache.org/${MY_PN}/docs/r${PV}"
|
|
70 }
|