summaryrefslogtreecommitdiff
path: root/pcr/icinga2/PKGBUILD
blob: d2c966c3e11e7b0ed4d55d91f0fb09184e776ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Maintainer (Arch): Malte Rabenseifner <mail@malte-rabenseifner.de>
# Contributor (Arch): bebehei <bebe@bebehei.de>

pkgname=icinga2
pkgver=2.3.4
pkgrel=3
pkgdesc="A libre host, service and network monitoring program."
license=('GPL')
arch=('i686' 'x86_64')
url="http://www.icinga.org"
depends=('boost-libs' 'yajl')
makedepends=('boost' 'cmake' 'libmariadbclient' 'postgresql-libs' 'yajl')
optdepends=('monitoring-plugins: plugins needed for icinga checks'
            'libmariadbclient: for MySQL support'
            'postgresql-libs: for PostgreSQL support')
backup=(etc/default/icinga2
        etc/icinga2/features-available/{api,checker,command,compatlog}.conf
        etc/icinga2/features-available/{debuglog,gelf,graphite,icingastatus}.conf
        etc/icinga2/features-available/{ido-mysql,ido-pgsql,livestatus,mainlog}.conf
        etc/icinga2/features-available/{notification,perfdata,statusdata,syslog}.conf
        etc/icinga2/{constants,icinga2,init,zones}.conf
        etc/logrotate.d/icinga2)
install='icinga2.install'
source=("https://github.com/Icinga/$pkgname/archive/v$pkgver.tar.gz")
sha256sums=('3a6d23214c90c1e308df784254659c51962f4c49b13093aff2095e1dfa06cdaa')

build() {
  mkdir -p "$srcdir/$pkgname-$pkgver/build"
  cd "$srcdir/$pkgname-$pkgver/build"

  cmake "$srcdir/$pkgname-$pkgver" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_SYSCONFDIR=/etc \
    -DICINGA2_RUNDIR=/run \
    -DCMAKE_INSTALL_SBINDIR=/usr/bin \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
    -DICINGA2_SYSCONFIGFILE=/etc/default/icinga2 \
    -DICINGA2_PLUGINDIR=/usr/lib/monitoring-plugins \
    -DUSE_SYSTEMD=ON

  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver/build"

  make DESTDIR="$pkgdir" install

  mv "$pkgdir/etc/icinga2/conf.d" "$pkgdir/etc/icinga2/conf.d.example"
  mkdir "$pkgdir/etc/icinga2/conf.d"
  rm "$pkgdir/etc/icinga2/features-enabled/checker.conf"
  rm "$pkgdir/etc/icinga2/features-enabled/mainlog.conf"
  rm "$pkgdir/etc/icinga2/features-enabled/notification.conf"
  rm -r "$pkgdir/run"

  mkdir -p "$pkgdir/usr/lib/tmpfiles.d"
  cat > "$pkgdir/usr/lib/tmpfiles.d/icinga2.conf" <<- EOF
	d /run/icinga2 0750 icinga icingacmd -
	d /run/icinga2/cmd 2750 icinga icingacmd -
	EOF

  cd "$srcdir/$pkgname-$pkgver"

  install -Dm644 tools/syntax/vim/ftdetect/icinga2.vim "$pkgdir/usr/share/vim/vimfiles/ftdetect/icinga2.vim"
  install -Dm644 tools/syntax/vim/syntax/icinga2.vim "$pkgdir/usr/share/vim/vimfiles/syntax/icinga2.vim"
  install -Dm644 tools/syntax/nano/icinga2.nanorc "$pkgdir/usr/share/nano/icinga2.nanorc"

  chmod 750 "$pkgdir/etc/icinga2" \
            "$pkgdir/var/lib/icinga2" \
            "$pkgdir/var/spool/icinga2" \
            "$pkgdir/var/cache/icinga2" \
            "$pkgdir/var/log/icinga2"
}