diff options
Diffstat (limited to 'community/icinga2/APKBUILD')
-rw-r--r-- | community/icinga2/APKBUILD | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/community/icinga2/APKBUILD b/community/icinga2/APKBUILD new file mode 100644 index 0000000000..a1b5cbcc5b --- /dev/null +++ b/community/icinga2/APKBUILD @@ -0,0 +1,118 @@ +# Contributor: Francesco Colista <fcolista@alpinelinux.org> +# Maintainer: Francesco Colista <fcolista@alpinelinux.org> +pkgname=icinga2 +pkgver=2.4.7 +pkgrel=0 +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 <<EOF + +Add the web server user to the icingacmd group in order to grant it write +permissions to the external command pipe and livestatus socket: + +For nginx, as example: + # adduser nginx icingacmd + +For Apache: + # adduser apache icingacmd + +For lighttpd: + # adduser lighttpd icingacmd +EOF +} + +bashcomp() { + depends="bash" + pkgdesc="Bash completions for $pkgname" + arch="noarch" + mkdir -p "$subpkgdir"/usr/share/bash-completion/completions + mv "$pkgdir"/etc/bash_completion.d/$pkgname "$subpkgdir"/usr/share/bash-completion/completions/$pkgname +} + + +md5sums="cd393ac62a754cc34f858eca0b706b15 icinga2-2.4.7.tar.gz +11d269affec451c7153a617929314bf9 icinga2.initd" +sha256sums="db00c3bf1be5b18a477953f39df467039521d4f00826951d5c6de43cef96acd9 icinga2-2.4.7.tar.gz +bdd669692d016116f8e1f623c9d145f73864a5637cdebde4ad8eaa4c3a9cc13e icinga2.initd" +sha512sums="2674eca10af63d59d640d9e9c2af6dc22381669fc8defbf11b4cd388fa3b63fb838ee09fd98a3d6bff6816a108ed025fc113cce55e481497c714b7df8def9d2d icinga2-2.4.7.tar.gz +f368ea15be7054503924696129fe6b413f9a5cb5344af89f9a0f84df98ac7ef8ab135de60845deced55a982b6b037ce1a00b437189c78fcab981d1e3babec2d5 icinga2.initd" |