aboutsummaryrefslogtreecommitdiffstats
path: root/community/icinga2/APKBUILD
blob: b577b29ef2c250068a7f61f1bcbf7784f7ea45f7 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=icinga2
pkgver=2.5.4
pkgrel=2
pkgdesc="An open source host, service and network monitoring program"
url="http://www.icinga.org"
arch="all !armhf"
license="GPL"
depends="monitoring-plugins"
makedepends="$depends_dev cmake bison flex boost-dev yajl-dev
	postgresql-dev mariadb-dev libressl-dev libedit-dev"
install="$pkgname.pre-install $pkgname.post-install"
pkgusers="icinga"
pkggroups="icinga"
subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch"
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"
	rm -r third-party/yajl
	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"

	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions
	mv "$pkgdir"/etc/bash_completion.d/$pkgname "$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}


md5sums="6c8fbb6bf95c27d36d4217168c9f829b  icinga2-2.5.4.tar.gz
11d269affec451c7153a617929314bf9  icinga2.initd"
sha256sums="f22ca17cd9951598ab6a1bc27c1ef82b9f1bb49795f69066ccd4d499faa240fc  icinga2-2.5.4.tar.gz
bdd669692d016116f8e1f623c9d145f73864a5637cdebde4ad8eaa4c3a9cc13e  icinga2.initd"
sha512sums="0fca05d3eb6722cedecaba1da78ebb7268482257f28e37831f6356c618cbd059304a9e27e1f786799f253940e3dcf8ffa7399060f3e0e15765594796657b3be4  icinga2-2.5.4.tar.gz
f368ea15be7054503924696129fe6b413f9a5cb5344af89f9a0f84df98ac7ef8ab135de60845deced55a982b6b037ce1a00b437189c78fcab981d1e3babec2d5  icinga2.initd"