kafka-bin-0.10.1.0.ebuild 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils user
  5. DESCRIPTION="A high-throughput distributed messaging system"
  6. HOMEPAGE="http://kafka.apache.org/"
  7. # pick recommended scala version
  8. SCALA_VERSION=2.11
  9. MY_PN="kafka"
  10. MY_P="${MY_PN}_${SCALA_VERSION}-${PV}"
  11. SRC_URI="mirror://apache/kafka/${PV}/${MY_P}.tgz"
  12. RESTRICT="mirror"
  13. LICENSE="Apache-2.0"
  14. SLOT="0"
  15. KEYWORDS="~amd64 ~x86"
  16. IUSE="internal-zookeeper"
  17. RDEPEND="
  18. || ( virtual/jre:1.8 virtual/jre:1.7 )
  19. "
  20. DEPEND="${RDEPEND}"
  21. S="${WORKDIR}/${MY_P}"
  22. INSTALL_DIR="/opt/${MY_PN}"
  23. pkg_setup() {
  24. enewgroup kafka
  25. enewuser kafka -1 /bin/sh /var/lib/kafka kafka
  26. }
  27. src_prepare() {
  28. sed -i -e 's:/tmp/zookeeper:/var/lib/kafka/zookeeper:' "config/zookeeper.properties" || die
  29. sed -i -e 's:/tmp/kafka-logs:/var/lib/kafka/logs:' "config/server.properties" || die
  30. }
  31. src_install() {
  32. insinto /etc/kafka
  33. doins config/zookeeper.properties config/server.properties
  34. if use "internal-zookeeper"; then
  35. keepdir /var/lib/kafka/zookeeper
  36. newinitd "${FILESDIR}/${MY_PN}-zookeeper.init.d" "${MY_PN}-zookeeper"
  37. fi
  38. keepdir /var/lib/kafka
  39. fowners -R kafka:kafka /var/lib/kafka
  40. keepdir /var/log/kafka
  41. fowners -R kafka:kafka /var/log/kafka
  42. newinitd "${FILESDIR}/${MY_PN}.init.d" "${MY_PN}"
  43. dodir "${INSTALL_DIR}"
  44. cp -pRP bin config libs "${ED}/${INSTALL_DIR}" || die
  45. fowners -R kafka:kafka "${INSTALL_DIR}"
  46. }