/[gentoo-x86]/net-analyzer/icinga/icinga-1.7.1-r3.ebuild
Gentoo

Contents of /net-analyzer/icinga/icinga-1.7.1-r3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Fri Aug 17 20:53:12 2012 UTC (9 months ago) by prometheanfire
Branch: MAIN
removed the unneeded dep on php

(Portage version: 2.1.10.65/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.13