Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/prometheanfire:master commit in: net-analyzer/icinga/
Date: Fri, 25 Nov 2011 17:59:25
Message-Id: e4edee847e2f35cbf4c448b853b0941a00a1119c.prometheanfire@gentoo
1 commit: e4edee847e2f35cbf4c448b853b0941a00a1119c
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 25 16:35:13 2011 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Fri Nov 25 16:35:13 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/prometheanfire.git;a=commit;h=e4edee84
7
8 First beta of 1.6
9
10 ---
11 net-analyzer/icinga/icinga-1.6.0_beta.ebuild | 229 ++++++++++++++++++++++++++
12 1 files changed, 229 insertions(+), 0 deletions(-)
13
14 diff --git a/net-analyzer/icinga/icinga-1.6.0_beta.ebuild b/net-analyzer/icinga/icinga-1.6.0_beta.ebuild
15 new file mode 100644
16 index 0000000..0a9fe6f
17 --- /dev/null
18 +++ b/net-analyzer/icinga/icinga-1.6.0_beta.ebuild
19 @@ -0,0 +1,229 @@
20 +# Copyright 1999-2011 Gentoo Foundation
21 +# Distributed under the terms of the GNU General Public License v2
22 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/icinga/icinga-1.5.1-r3.ebuild,v 1.2 2011/11/22 21:06:50 prometheanfire Exp $
23 +
24 +EAPI=2
25 +
26 +inherit depend.apache eutils multilib toolchain-funcs versionator
27 +
28 +DESCRIPTION="Nagios Fork - Check daemon, CGIs, docs, IDOutils"
29 +HOMEPAGE="http://www.icinga.org/"
30 +#SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
31 +
32 +MY_P="${PN}-$(replace_version_separator 3 '')"
33 +SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
34 +S=${WORKDIR}/${MY_P}
35 +
36 +
37 +LICENSE="GPL-2"
38 +SLOT="0"
39 +KEYWORDS="~amd64 ~x86"
40 +IUSE="+apache2 debug +idoutils lighttpd +mysql perl plugins postgres ssl +vim-syntax +web"
41 +DEPEND="idoutils? ( dev-db/libdbi-drivers[mysql?,postgres?] )
42 + perl? ( dev-lang/perl )
43 + virtual/mailx
44 + web? (
45 + media-libs/gd[jpeg,png]
46 + lighttpd? ( www-servers/lighttpd dev-lang/php[cgi] )
47 + apache2? ( || ( dev-lang/php[apache2] dev-lang/php[cgi] ) )
48 + )
49 + !net-analyzer/nagios-core"
50 +RDEPEND="${DEPEND}
51 + plugins? ( net-analyzer/nagios-plugins )"
52 +
53 +want_apache2
54 +
55 +pkg_setup() {
56 + depend.apache_pkg_setup
57 + enewgroup icinga
58 + enewgroup nagios
59 + enewuser icinga -1 -1 /var/spool/icinga "icinga,nagios"
60 + if use web ; then
61 + elog "This does not include cgis that are perl-dependent"
62 + elog "Currently traceroute.cgi is perl-dependent"
63 + elog "Note that the user your webserver is running as needs"
64 + elog "read-access to /etc/icinga."
65 + elog
66 + if use apache2 || use lighttpd ; then
67 + elog "There are several possible solutions to accomplish this,"
68 + elog "choose the one you are most comfortable with:"
69 + elog
70 + if use apache2 ; then
71 + elog " usermod -G icinga apache"
72 + elog "or"
73 + elog " chown icinga:apache /etc/icinga"
74 + elog
75 + elog "Also edit /etc/conf.d/apache2 and add \"-D ICINGA\""
76 + elog
77 + elog "Icinga web service needs user authentication. If you"
78 + elog "use the base configuration, you need a password file"
79 + elog "with a password for user \"icingaadmin\""
80 + elog "You can create this file by executing:"
81 + elog "htpasswd -c /etc/icinga/htpasswd.users icingaadmin"
82 + elif use lighttpd ; then
83 + elog " usermod -G icinga lighttpd "
84 + elog "or"
85 + elog " chown icinga:lighttpd /etc/icinga"
86 + elog "Also edit /etc/lighttpd/lighttpd.conf and add 'include \"lighttpd_icinga.conf\"'"
87 + fi
88 + elog
89 + elog "That will make icinga's web front end visable via"
90 + elog "http://localhost/icinga/"
91 + elog
92 + else
93 + elog "IMPORTANT: Do not forget to add the user your webserver"
94 + elog "is running as to the icinga group!"
95 + fi
96 +
97 + else
98 + ewarn "Please note that you have installed Icinga without web interface."
99 + ewarn "Please don't file any bugs about having no web interface when you do this."
100 + ewarn "Thank you!"
101 + fi
102 +
103 +}
104 +
105 +src_prepare() {
106 + epatch "${FILESDIR}/fix-prestripped-binaries.patch"
107 +}
108 +
109 +src_configure() {
110 + local myconf
111 + local myconf2
112 +
113 + myconf="$(use_enable perl embedded-perl)
114 + $(use_with perl perlcache)
115 + $(use_enable idoutils)
116 + $(use_enable ssl)
117 + $(use_enable debug DEBUG0)
118 + $(use_enable debug DEBUG1)
119 + $(use_enable debug DEBUG2)
120 + $(use_enable debug DEBUG3)
121 + $(use_enable debug DEBUG4)
122 + $(use_enable debug DEBUG5)
123 + --disable-statuswrl
124 + --with-cgiurl=/icinga/cgi-bin
125 + --with-log-dir=/var/log/icinga"
126 +
127 + myconf2="--bindir=/usr/sbin
128 + --sbindir=/usr/$(get_libdir)/icinga/cgi-bin
129 + --datarootdir=/usr/share/icinga/htdocs
130 + --localstatedir=/var/lib/icinga
131 + --sysconfdir=/etc/icinga"
132 +
133 + if use plugins ; then
134 + myconf2+=" --libexecdir=/usr/$(get_libdir)/nagios/plugins"
135 + else
136 + myconf2+=" --libexecdir=/usr/$(get_libdir)/icinga/plugins"
137 + fi
138 +
139 + if use !apache2 && use !lighttpd ; then
140 + myconf2+=" --with-command-group=icinga"
141 + else
142 + if use apache2 ; then
143 + myconf+=" --with-httpd-conf=/etc/apache2/conf.d"
144 + myconf2+=" --with-command-group=apache"
145 + elif use lighttpd ; then
146 + myconf2+=" --with-command-group=lighttpd"
147 + fi
148 + fi
149 +
150 + econf ${myconf} ${myconf2}
151 +}
152 +
153 +src_compile() {
154 + tc-export CC
155 +
156 + emake icinga || die "make failed"
157 +
158 + if use web ; then
159 + emake DESTDIR="${D}" cgis || die
160 + fi
161 +
162 + if use idoutils ; then
163 + emake DESTDIR="${D}" idoutils || die
164 + fi
165 +}
166 +
167 +src_install() {
168 + dodoc Changelog README UPGRADING || die
169 +
170 + if ! use web ; then
171 + sed -i -e '/cd $(SRC_\(CGI\|HTM\))/d' Makefile || die
172 + fi
173 +
174 + sed -i -e 's/^contactgroups$//g' Makefile || die
175 +
176 + emake DESTDIR="${D}" install{,-config,-commandmode} || die
177 +
178 + sed -i -e 's/var\/lib\/icinga\/icinga.lock/var\/run\/icinga\/icinga.lock/g' "${D}"/etc/icinga/icinga.cfg || die
179 + sed -i -e 's/var\/icinga\/icinga.tmp/tmp\/icinga\/icinga.tmp/g' "${D}"/etc/icinga/icinga.cfg || die
180 +
181 + if use idoutils ; then
182 + emake DESTDIR="${D}" install-idoutils || die
183 + fi
184 +
185 + newinitd "${FILESDIR}"/icinga-init.d-2 icinga || die
186 + newconfd "${FILESDIR}"/icinga-conf.d icinga || die
187 + if use idoutils ; then
188 + newinitd "${FILESDIR}"/ido2db-init.d ido2db || die
189 + newconfd "${FILESDIR}"/ido2db-conf.d ido2db || die
190 + insinto /usr/share/icinga/contrib/db
191 + doins -r module/idoutils/db/* || die
192 + fi
193 + # Apache Module
194 + if use web ; then
195 + if use apache2 ; then
196 + insinto "${APACHE_MODULES_CONFDIR}"
197 + newins "${FILESDIR}"/icinga-apache.conf 99_icinga.conf || die
198 + elif use lighttpd ; then
199 + insinto /etc/lighttpd
200 + newins "${FILESDIR}"/icinga-lighty.conf lighttpd_icinga.conf || die
201 + else
202 + ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
203 + ewarn "out-of-the-box. Since you are not using one of them, you"
204 + ewarn "have to configure your webserver accordingly yourself."
205 + fi
206 + fi
207 +
208 + fowners -R root:root /usr/$(get_libdir)/icinga || die
209 + cd "${D}" || die
210 + find usr/$(get_libdir)/icinga -type d -exec fperms 755 {} +
211 + find usr/$(get_libdir)/icinga/cgi-bin -type f -exec fperms 755 {} +
212 + dodir /var/run/icinga || die
213 + fowners icinga:icinga /var/run/icinga || die
214 +
215 + keepdir /etc/icinga
216 + keepdir /var/lib/icinga
217 + keepdir /var/lib/icinga/archives
218 + keepdir /var/lib/icinga/rw
219 + keepdir /var/lib/icinga/spool/checkresults
220 +
221 + if use apache2 ; then
222 + webserver=apache
223 + elif use lighttpd ; then
224 + webserver=lighttpd
225 + else
226 + webserver=icinga
227 + fi
228 +
229 + fowners icinga:icinga /var/lib/icinga || die "Failed chown of /var/lib/icinga"
230 + fowners -R icinga:${webserver} /var/lib/icinga/rw || die "Failed chown of /var/lib/icinga/rw"
231 +
232 + fperms 6755 /var/lib/icinga/rw || die "Failed Chmod of ${D}/var/lib/icinga/rw"
233 + fperms 0750 /etc/icinga || die "Failed chmod of ${D}/etc/icinga"
234 +}
235 +
236 +pkg_postinst() {
237 + elog "If you want icinga to start at boot time"
238 + elog "remember to execute:"
239 + elog " rc-update add icinga default"
240 + elog
241 + elog "If your kernel has /proc protection, icinga"
242 + elog "will not be happy as it relies on accessing the proc"
243 + elog "filesystem. You can fix this by adding icinga into"
244 + elog "the group wheel, but this is not recomended."
245 + elog
246 + elog "/var/icinga was moved to /var/lib/icinga"
247 + elog "please move the file if this was an upgrade"
248 +}