summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ddf08227b1ef58114c5a874e3559850f49d499ad (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
75
76
77
78
# Maintainer: Idares <idares at seznam dot cz>

pkgname=nagios
pkgver=4.4.3
pkgrel=1
pkgdesc="Nagios is an open source host, service and network monitoring program."
license=('GPL')
arch=('i686' 'x86_64')
url="http://www.nagios.org"
depends=('gd' 'freetype2' 'libtool' 'glib2')
makedepends=('unzip')
optdepends=('monitoring-plugins: a bundle of standard plugins'
            'apache' 'php-apache' 'nginx' 'php' 'php-fpm' 'fcgiwrap')
source=("http://downloads.sourceforge.net/nagios/$pkgname-$pkgver.tar.gz"
        "nagios.install")
install='nagios.install'

_nagios_user="nagios"
_nagios_group="nagios"
_instdir="usr/share/nagios"
_bindir="usr/bin"
_vardir="var/nagios"
_confdir="etc/nagios"
_httpdconfdir="etc/webapps/$pkgname/"
_checkresultdir="var/nagios/spool/checkresults"
_perldir="$_instdir/bin"

getent group $_nagios_group > /dev/null || _nagios_group=30
getent passwd $_nagios_user > /dev/null || _nagios_user=30

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

	./configure \
		--with-nagios-user=$_nagios_user \
		--with-nagios-group=$_nagios_group \
		--prefix="/$_instdir" \
		--bindir="/$_bindir" \
		--localstatedir="/$_vardir" \
		--sysconfdir="/$_confdir" \
		--with-httpd-conf="/$_httpdconfdir" \
		--with-checkresultdir="/$_checkresultdir" \
		--enable-embedded-perl

	make all
}

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

	DESTDIR="$pkgdir/" make \
		prefix=$_instdir \
		BINDIR=$_bindir \
		LOGDIR=$_vardir \
		CFGDIR=$_confdir \
		HTTPD_CONF=$_httpdconfdir \
		CHECKRESULTDIR=$_checkresultdir \
		install install-config

	install -D -m 644 sample-config/httpd.conf $pkgdir/$_httpdconfdir/apache.example.conf
	install -D -m 644 startup/default-service $pkgdir/usr/lib/systemd/system/nagios.service

	mkdir $pkgdir/var/nagios/rw
	chown $_nagios_user.$_nagios_group $pkgdir/var/nagios/rw
	chmod 755 $pkgdir/var/nagios/rw

	chmod 755 $pkgdir/usr/bin
	chmod 755 $pkgdir/usr/bin/nagios

	find $pkgdir/etc/nagios -name '*cfg' -exec mv "{}" "{}.sample" \; > /dev/null

}

md5sums=('8beb253b1236ee1407f698b5d2a2d894'
         'e11fa7de430ed858269f82e179fc87ca')
sha1sums=('2401f9f70ba50bba1716f95ca5252a6bbec945bf'
          '04008cee208226e60b099550bd9ec7dc78cb1457')