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