# Contributor: Francesco Colista # Maintainer: Francesco Colista pkgname=icinga2 pkgver=2.4.7 pkgrel=1 pkgdesc="An open source host, service and network monitoring program" url="http://www.icinga.org" arch="all" license="GPL" depends="monitoring-plugins" depends_dev="" makedepends="$depends_dev cmake bison flex boost-dev yajl postgresql-dev mariadb-dev openssl-dev" install="$pkgname.pre-install $pkgname.post-install" pkgusers="icinga" pkggroups="icinga" subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp" source="$pkgname-$pkgver.tar.gz::https://github.com/Icinga/$pkgname/archive/v$pkgver.tar.gz $pkgname.initd" _builddir="$srcdir/$pkgname-$pkgver" prepare() { local i cd "$_builddir" for i in $source; do case $i in *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done mkdir -p build } build() { cd "$_builddir"/build cmake "$srcdir/$pkgname-$pkgver" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_SYSCONFDIR=/etc \ -DICINGA2_RUNDIR=/run \ -DCMAKE_INSTALL_SBINDIR=/usr/sbin \ -DCMAKE_INSTALL_LIBDIR=/usr/lib \ -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ -DICINGA2_SYSCONFIGFILE=/etc/icinga2 \ -DICINGA2_PLUGINDIR=/usr/lib/monitoring-plugins \ -DICINGA2_USER=$pkgusers \ -DICINGA2_GROUP=${pkggroups}cmd \ -DICINGA2_COMMAND_USER=$pkgusers \ -DICINGA2_COMMAND_GROUP=${pkggroups}cmd \ -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=no make || return 1 } package() { cd "$_builddir"/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 .. 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" rm "$pkgdir"/etc/init.d/$pkgname chown -R $pkgusers:$pkggroups "$pkgdir"/etc/icinga2 chown -R $pkgusers:$pkggroups "$pkgdir"/var/lib/icinga2 chown $pkgusers:$pkggroups "$pkgdir"/var/spool/icinga2 chown $pkgusers:$pkggroups "$pkgdir"/var/cache/icinga2/perfdata chown -R $pkgusers:${pkggroups}cmd "$pkgdir"/var/cache/icinga2 chown -R $pkgusers:${pkggroups}cmd "$pkgdir"/var/log/icinga2 install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname cat >"$pkgdir"/usr/share/doc/$pkgname/README.alpine <