PKGBUILD 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. # Maintainer (aur): Julian Brost <julian@0x4a42.net>
  2. # Maintainer (aur): Malte Rabenseifner <mail@malte-rabenseifner.de>
  3. # Contributor: bebehei <bebe@bebehei.de>
  4. pkgname=icinga2
  5. pkgver=2.12.3
  6. pkgrel=2
  7. pkgdesc="An open source host, service and network monitoring program"
  8. pkgdesc="${pkgdesc/An open source host, service/Host, service,}"
  9. license=('GPL')
  10. arch=('i686' 'x86_64')
  11. arch+=('armv7h')
  12. url="http://www.icinga.org"
  13. depends=('boost-libs' 'libedit' 'libsystemd' 'openssl' 'yajl')
  14. optdepends=('monitoring-plugins: plugins needed for icinga checks'
  15. 'libmariadbclient: for MySQL support'
  16. 'postgresql-libs: for PostgreSQL support')
  17. makedepends=('boost' 'cmake' 'libmariadbclient' 'postgresql-libs' 'systemd')
  18. replaces=('icinga2-common')
  19. replaces+=('icinga-studio')
  20. backup=(etc/default/icinga2
  21. etc/icinga2/features-available/api.conf
  22. etc/icinga2/features-available/checker.conf
  23. etc/icinga2/features-available/command.conf
  24. etc/icinga2/features-available/compatlog.conf
  25. etc/icinga2/features-available/debuglog.conf
  26. etc/icinga2/features-available/elasticsearch.conf
  27. etc/icinga2/features-available/gelf.conf
  28. etc/icinga2/features-available/graphite.conf
  29. etc/icinga2/features-available/icingadb.conf
  30. etc/icinga2/features-available/ido-mysql.conf
  31. etc/icinga2/features-available/ido-pgsql.conf
  32. etc/icinga2/features-available/influxdb.conf
  33. etc/icinga2/features-available/livestatus.conf
  34. etc/icinga2/features-available/mainlog.conf
  35. etc/icinga2/features-available/notification.conf
  36. etc/icinga2/features-available/opentsdb.conf
  37. etc/icinga2/features-available/perfdata.conf
  38. etc/icinga2/features-available/statusdata.conf
  39. etc/icinga2/features-available/syslog.conf
  40. etc/icinga2/constants.conf
  41. etc/icinga2/icinga2.conf
  42. etc/icinga2/scripts/mail-host-notification.sh
  43. etc/icinga2/scripts/mail-service-notification.sh
  44. etc/icinga2/zones.conf
  45. etc/init.d/icinga2
  46. etc/logrotate.d/icinga2)
  47. install='icinga2.install'
  48. changelog="icinga2.changelog"
  49. source=($pkgname-$pkgver.tar.gz::https://github.com/Icinga/$pkgname/archive/v$pkgver.tar.gz
  50. boost-1.74-8184.patch # https://patch-diff.githubusercontent.com/raw/Icinga/icinga2/pull/8184.patch
  51. boost-1.74-8191.patch # https://patch-diff.githubusercontent.com/raw/Icinga/icinga2/pull/8191.patch
  52. boost-1.74-8575.patch # https://patch-diff.githubusercontent.com/raw/Icinga/icinga2/pull/8575.patch
  53. $pkgname.tmpfiles
  54. $pkgname.sysusers)
  55. sha256sums=('56387d5e047df04fd91fdb8db3124eb09325c7377fbcaa11ef063147db816dfb'
  56. 'dc1a2530d1c2c311826443cebaaa3c307f400e6a995414c654f4e6b94ec8b885'
  57. '297c38f5e682ebed1c399997fa3955dfd383b13ae1a9086e73a5272ab1c995cd'
  58. '51578f037ae87ac5336473199ccf31f0097402eb57e73383fbe9899c09063da8'
  59. '1302b333f49ead14f8808a379535971501d3a0c1ba02a7bf7b4406b7d27c754c'
  60. '2f946a33ea50a3c4400a81acd778e6411ffe5e2257a98004288b84a64f382810')
  61. _is_nonsystemd_host=0 # set this to 1, if building on a non-systemd host (redmine #2969)
  62. prepare() {
  63. cd "$srcdir/$pkgname-$pkgver"
  64. patch -p1 < "$srcdir/8184.patch"
  65. patch -p1 < "$srcdir/8191.patch"
  66. patch -p1 < "$srcdir/8575.patch"
  67. }
  68. build() {
  69. mkdir -p "$srcdir/$pkgname-$pkgver/build"
  70. cd "$srcdir/$pkgname-$pkgver/build"
  71. cmake "$srcdir/$pkgname-$pkgver" \
  72. -DCMAKE_INSTALL_PREFIX=/usr \
  73. -DCMAKE_INSTALL_SYSCONFDIR=/etc \
  74. -DICINGA2_RUNDIR=/run \
  75. -DCMAKE_INSTALL_SBINDIR=/usr/bin \
  76. -DCMAKE_INSTALL_LIBDIR=/usr/lib \
  77. -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
  78. -DICINGA2_SYSCONFIGFILE=/etc/default/icinga2 \
  79. -DICINGA2_PLUGINDIR=/usr/lib/monitoring-plugins \
  80. -DUSE_SYSTEMD=ON \
  81. -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=ON \
  82. $( (( _is_nonsystemd_host )) && echo '-DSYSTEMD_INCLUDE_DIR=/usr/include/elogind/' ) \
  83. -DLOGROTATE_HAS_SU=OFF
  84. make
  85. }
  86. package() {
  87. cd "$srcdir/$pkgname-$pkgver/build"
  88. make DESTDIR="$pkgdir" install
  89. # move default config to conf.d.example
  90. mv "$pkgdir/etc/icinga2/conf.d" "$pkgdir/etc/icinga2/conf.d.example"
  91. mkdir "$pkgdir/etc/icinga2/conf.d"
  92. # restrict some filesystem locations by default
  93. chmod 750 "$pkgdir/etc/icinga2" \
  94. "$pkgdir/var/lib/icinga2" \
  95. "$pkgdir/var/spool/icinga2" \
  96. "$pkgdir/var/cache/icinga2" \
  97. "$pkgdir/var/log/icinga2"
  98. # config files for creating users, groups and tmp files/dirs
  99. install -Dm644 "$srcdir/$pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
  100. install -Dm644 "$srcdir/$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
  101. # install syntax highlighting for vim and nano
  102. cd "$srcdir/$pkgname-$pkgver"
  103. install -Dm644 tools/syntax/vim/ftdetect/icinga2.vim "$pkgdir/usr/share/vim/vimfiles/ftdetect/icinga2.vim"
  104. install -Dm644 tools/syntax/vim/syntax/icinga2.vim "$pkgdir/usr/share/vim/vimfiles/syntax/icinga2.vim"
  105. install -Dm644 tools/syntax/nano/icinga2.nanorc "$pkgdir/usr/share/nano/icinga2.nanorc"
  106. # remove features-enabled symlink from the package so that they are not
  107. # recreated on package upgrades. they are initially set-up in the
  108. # post_install script.
  109. rm "$pkgdir/etc/icinga2/features-enabled/checker.conf"
  110. rm "$pkgdir/etc/icinga2/features-enabled/mainlog.conf"
  111. rm "$pkgdir/etc/icinga2/features-enabled/notification.conf"
  112. # ensure that nothing it left in features enables. make sure to keep the list
  113. # above in sync with post_install. rmdir && mkdir seems to be the easiest way
  114. # to check if the directory was actually empty.
  115. rmdir "$pkgdir/etc/icinga2/features-enabled" && mkdir "$pkgdir/etc/icinga2/features-enabled" || {
  116. error 'Features enabled by make install are inconsistent with those in package().'
  117. ls -l "$pkgdir/etc/icinga2/features-enabled"
  118. return 1
  119. }
  120. # check that the backup array contains all files in /etc except those explicitly excluded in the command below.
  121. diff -u \
  122. <(printf '%s\n' "${backup[@]}" | sort) \
  123. <(find "$pkgdir/etc" '(' \
  124. -path "$pkgdir/etc/bash_completion.d" -o \
  125. -path "$pkgdir/etc/icinga2/conf.d.example" -o \
  126. -path "$pkgdir/etc/icinga2/zones.d/README" \
  127. ')' -prune -o -type f -printf 'etc/%P\n' | sort) || {
  128. error 'Backup array and file installed to /etc are inconsistent.'
  129. return 1
  130. }
  131. # some cleanup
  132. rm -r "$pkgdir/run"
  133. }