mms-agent-3.7.0.212_p1.ebuild 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils user
  5. MY_PV=${PV/_p/-}
  6. DESCRIPTION="MongoDB MMS agents"
  7. HOMEPAGE="http://mms.mongodb.com"
  8. SRC_URI="
  9. monitoring? (
  10. amd64? ( https://mms.mongodb.com/download/agent/monitoring/mongodb-mms-monitoring-agent-${MY_PV}.linux_x86_64.tar.gz )
  11. x86? ( https://mms.mongodb.com/download/agent/monitoring/mongodb-mms-monitoring-agent-${MY_PV}.linux_i386.tar.gz )
  12. )
  13. "
  14. LICENSE="Apache-2.0"
  15. SLOT="0"
  16. KEYWORDS="amd64 x86"
  17. IUSE="+monitoring"
  18. REQUIRED_USE="|| ( monitoring )"
  19. RDEPEND="!<dev-db/mongodb-3.0.0[mms-agent]"
  20. DEPEND="${RDEPEND}"
  21. S=${WORKDIR}
  22. pkg_setup() {
  23. enewgroup mongodb
  24. enewuser mongodb -1 -1 /var/lib/${PN} mongodb
  25. }
  26. src_install() {
  27. if use amd64; then
  28. local arch="x86_64"
  29. else
  30. local arch="i386"
  31. fi
  32. if use monitoring; then
  33. local MY_PN="mms-monitoring-agent"
  34. local MY_D="/opt/${MY_PN}"
  35. pushd "${S}/mongodb-mms-monitoring-agent-${MY_PV}.linux_${arch}"
  36. insinto ${MY_D}
  37. doins mongodb-mms-monitoring-agent
  38. fperms +x "${MY_D}"/mongodb-mms-monitoring-agent
  39. insinto /etc
  40. doins monitoring-agent.config
  41. rm monitoring-agent.config
  42. dosym /etc/monitoring-agent.config ${MY_D}/monitoring-agent.config
  43. fowners -R mongodb:mongodb ${MY_D}
  44. newinitd "${FILESDIR}/${MY_PN}.initd" ${MY_PN}
  45. popd
  46. fi
  47. }
  48. pkg_postinst() {
  49. if use monitoring; then
  50. elog "MMS Monitoring Agent configuration file :"
  51. elog " /etc/monitoring-agent.config"
  52. fi
  53. }