summaryrefslogtreecommitdiff
path: root/pcr
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2015-05-19 18:40:50 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2015-05-19 18:40:50 -0300
commitcea8490173dfafe478f0feb3d01311ff0d42408a (patch)
tree30cbf0bf32d48971140634bb863840a6bc779365 /pcr
parenta41018125d32a20b644ff10836d1e737cd0dfa67 (diff)
icinga2: add new package to [pcr] -> https://labs.parabola.nu/issues/724
Diffstat (limited to 'pcr')
-rw-r--r--pcr/icinga2/PKGBUILD68
-rw-r--r--pcr/icinga2/icinga2.install52
2 files changed, 120 insertions, 0 deletions
diff --git a/pcr/icinga2/PKGBUILD b/pcr/icinga2/PKGBUILD
new file mode 100644
index 000000000..02b36f3c3
--- /dev/null
+++ b/pcr/icinga2/PKGBUILD
@@ -0,0 +1,68 @@
+# Maintainer (Arch): Malte Rabenseifner <mail@malte-rabenseifner.de>
+# Contributor (Arch): bebehei <bebe@bebehei.de>
+
+pkgname=icinga2
+pkgver=2.3.4
+pkgrel=1
+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
+
+ chmod 750 "$pkgdir/etc/icinga2" \
+ "$pkgdir/var/lib/icinga2" \
+ "$pkgdir/var/spool/icinga2" \
+ "$pkgdir/var/cache/icinga2" \
+ "$pkgdir/var/log/icinga2"
+}
diff --git a/pcr/icinga2/icinga2.install b/pcr/icinga2/icinga2.install
new file mode 100644
index 000000000..86ea3d4bc
--- /dev/null
+++ b/pcr/icinga2/icinga2.install
@@ -0,0 +1,52 @@
+post_install() {
+ /usr/bin/getent group icinga &> /dev/null || /usr/bin/groupadd -r icinga &> /dev/null
+ /usr/bin/getent group icingacmd &> /dev/null || /usr/bin/groupadd -r icingacmd &> /dev/null
+ /usr/bin/getent passwd icinga &> /dev/null || /usr/bin/useradd -r -c "icinga" -M -d /var/spool/icinga2 -g icinga -G icingacmd -s /usr/bin/nologin icinga &> /dev/null
+
+ /usr/bin/chown -R icinga:icinga \
+ /etc/icinga2 \
+ /var/lib/icinga2 \
+ /var/spool/icinga2
+
+ /usr/bin/chown -R icinga:icingacmd \
+ /var/cache/icinga2 \
+ /var/log/icinga2
+
+ /usr/bin/systemd-tmpfiles --create icinga2.conf
+
+ /usr/bin/icinga2 feature enable checker &> /dev/null
+ /usr/bin/icinga2 feature enable mainlog &> /dev/null
+ /usr/bin/icinga2 feature enable notification &> /dev/null
+}
+
+pre_upgrade() {
+ /usr/bin/chown -R root:root \
+ /etc/icinga2 \
+ /var/lib/icinga2 \
+ /var/spool/icinga2 \
+ /var/cache/icinga2 \
+ /var/log/icinga2
+}
+
+post_upgrade() {
+ /usr/bin/chown -R icinga:icinga \
+ /etc/icinga2 \
+ /var/lib/icinga2 \
+ /var/spool/icinga2
+
+ /usr/bin/chown -R icinga:icingacmd \
+ /var/cache/icinga2 \
+ /var/log/icinga2
+}
+
+pre_remove() {
+ [ -f "/etc/icinga2/features-enabled/checker.conf" ] && /usr/bin/icinga2 feature disable checker &> /dev/null
+ [ -f "/etc/icinga2/features-enabled/mainlog.conf" ] && /usr/bin/icinga2 feature disable mainlog &> /dev/null
+ [ -f "/etc/icinga2/features-enabled/notification.conf" ] && /usr/bin/icinga2 feature disable notification &> /dev/null
+}
+
+post_remove() {
+ /usr/bin/getent passwd icinga &> /dev/null && /usr/bin/userdel icinga &> /dev/null
+ /usr/bin/getent group icinga &> /dev/null && /usr/bin/groupdel icinga &> /dev/null
+ /usr/bin/getent group icingacmd &> /dev/null && /usr/bin/groupdel icingacmd &> /dev/null
+}