graylog2-2.2.2.ebuild 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit user
  5. DESCRIPTION="Free and open source log management"
  6. HOMEPAGE="https://graylog.org"
  7. SRC_URI="https://packages.graylog2.org/releases/graylog/graylog-${PV}.tgz"
  8. LICENSE="GPL-3"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~ppc64 ~x86"
  11. MY_PN="graylog"
  12. S="${WORKDIR}/${MY_PN}-${PV}"
  13. INSTALL_DIR="/usr/share/graylog2"
  14. DATA_DIR="/var/lib/graylog2"
  15. QA_PREBUILT="${INSTALL_DIR}/lib/sigar/libsigar*"
  16. RESTRICT="strip"
  17. RDEPEND="virtual/jdk:1.8"
  18. pkg_setup() {
  19. enewgroup graylog
  20. enewuser graylog -1 -1 -1 graylog
  21. }
  22. src_prepare() {
  23. default
  24. # graylogctl is replaced by our own initd
  25. rm -r bin
  26. # Stick to architecture of build host
  27. if ! use amd64; then
  28. rm -r lib/sigar/libsigar-amd64-*.so || die "Failed in removing AMD64 support libraries"
  29. fi
  30. if ! use ppc64; then
  31. rm -r lib/sigar/libsigar-ppc64-*.so || die "Failed in removing PPC64 support libraries"
  32. fi
  33. if ! use x86; then
  34. rm -r lib/sigar/libsigar-x86-*.so || die "Failed in removing X86 support libraries"
  35. fi
  36. # Currently unsupported platforms
  37. # QA warning galore but testing/patches welcome
  38. rm lib/sigar/libsigar-*freebsd*so \
  39. lib/sigar/libsigar-*solaris*so \
  40. lib/sigar/libsigar-*hpux*.sl \
  41. lib/sigar/libsigar-*macosx*.dylib \
  42. lib/sigar/libsigar-ia64-*.so \
  43. lib/sigar/libsigar-ppc-*.so \
  44. lib/sigar/libsigar-s390x*.so \
  45. lib/sigar/*winnt* || die "Failed in removing unsupported platform libraries"
  46. # remove plugins
  47. rm plugin/graylog-plugin-anonymous-usage-statistics-${PV}.jar || die
  48. # gentoo specific paths
  49. sed -i "s@\(node_id_file = \).*@\1${DATA_DIR}/node-id@g; \
  50. s@\(message_journal_dir = \).*@\1${DATA_DIR}/data/journal@g; \
  51. s@#\(content_packs_dir = \).*@\1/${DATA_DIR}/data/contentpacks@g" \
  52. graylog.conf.example || die
  53. }
  54. src_compile() {
  55. einfo "Nothing to compile; upstream supplies JAR only"
  56. }
  57. src_install() {
  58. insinto /etc/graylog2
  59. doins graylog.conf.example
  60. insinto ${DATA_DIR}/data/contentpacks
  61. doins data/contentpacks/grok-patterns.json
  62. insinto "${INSTALL_DIR}"
  63. doins *
  64. doins -r lib plugin
  65. newinitd "${FILESDIR}/initd-r1" graylog2
  66. newconfd "${FILESDIR}/confd-r1" graylog2
  67. }