| 1 |
axs |
1.1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
|
# $Header: $ |
| 4 |
|
|
|
| 5 |
|
|
EAPI=4 |
| 6 |
|
|
|
| 7 |
|
|
inherit eutils confutils depend.php depend.apache |
| 8 |
|
|
|
| 9 |
|
|
DESCRIPTION="NagVis is a visualization addon for the well known network managment system Nagios." |
| 10 |
|
|
HOMEPAGE="http://www.nagvis.org/" |
| 11 |
|
|
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" |
| 12 |
|
|
|
| 13 |
|
|
LICENSE="GPL-2" |
| 14 |
|
|
SLOT="0" |
| 15 |
|
|
KEYWORDS="~amd64 ~x86" |
| 16 |
|
|
IUSE="apache2 automap" |
| 17 |
|
|
|
| 18 |
|
|
DEPEND="" |
| 19 |
|
|
RDEPEND="|| ( net-analyzer/nagios net-analyzer/icinga ) |
| 20 |
|
|
automap? ( >=media-gfx/graphviz-2.14 ) |
| 21 |
|
|
apache2? ( dev-lang/php[apache2] ) |
| 22 |
|
|
net-analyzer/mk-livestatus |
| 23 |
|
|
dev-lang/php[gd,nls,json,session,pdo,sqlite3,sockets,mysql,unicode,xml]" |
| 24 |
|
|
|
| 25 |
|
|
need_php_httpd |
| 26 |
|
|
want_apache2 |
| 27 |
|
|
|
| 28 |
|
|
pkg_setup() { |
| 29 |
|
|
confutils_require_built_with_all dev-lang/php gd nls json session pdo sqlite3 sockets mysql unicode xml |
| 30 |
|
|
depend.apache_pkg_setup |
| 31 |
|
|
} |
| 32 |
|
|
|
| 33 |
|
|
src_prepare() { |
| 34 |
|
|
epatch "${FILESDIR}"/${P}-base-path.patch |
| 35 |
|
|
epatch "${FILESDIR}"/${P}-global-definitions.patch |
| 36 |
|
|
grep -Rl "/usr/local" "${S}"/* | xargs sed -i s:/usr/local:/usr:g ||die |
| 37 |
|
|
sed -i s:@NAGVIS_WEB@:/nagvis:g "${S}"/etc/apache2-nagvis.conf-sample ||die |
| 38 |
|
|
sed -i s:@NAGVIS_PATH@:/usr/share/nagvis/:g "${S}"/etc/apache2-nagvis.conf-sample ||die |
| 39 |
|
|
sed -i s:/usr/nagios/var/rw/live:/var/nagios/rw/live:g "${S}"/etc/nagvis.ini.php-sample ||die |
| 40 |
|
|
} |
| 41 |
|
|
|
| 42 |
|
|
src_install() { |
| 43 |
|
|
dodoc README INSTALL |
| 44 |
|
|
|
| 45 |
|
|
insinto /usr/share/nagvis |
| 46 |
|
|
doins -r share/{config.php,index.php,frontend,netmap,server,userfiles} |
| 47 |
|
|
doins -r docs |
| 48 |
|
|
|
| 49 |
|
|
diropts -o apache -g root |
| 50 |
|
|
dodir /var/nagvis/tmpl/{cache,compile} |
| 51 |
|
|
diropts |
| 52 |
|
|
dosym /var/nagvis /usr/share/nagvis/var |
| 53 |
|
|
|
| 54 |
|
|
if use apache2 ; then |
| 55 |
|
|
insinto "${APACHE_MODULES_CONFDIR}" |
| 56 |
|
|
newins etc/apache2-nagvis.conf-sample 98_${PN}.conf |
| 57 |
|
|
fi |
| 58 |
|
|
|
| 59 |
|
|
insinto /etc/nagvis |
| 60 |
|
|
doins -r etc/{conf.d,automaps,geomap,.htaccess,nagvis.ini.php-sample} |
| 61 |
|
|
fowners apache:root /etc/nagvis |
| 62 |
|
|
fperms 0664 /etc/nagvis/nagvis.ini.php-sample |
| 63 |
|
|
dosym /etc/nagvis /usr/share/nagvis/etc |
| 64 |
|
|
|
| 65 |
|
|
diropts -o apache -g root -m0775 |
| 66 |
|
|
insopts -o apache -g root -m0664 |
| 67 |
|
|
doins -r etc/maps |
| 68 |
|
|
diropts |
| 69 |
|
|
insopts |
| 70 |
|
|
|
| 71 |
|
|
# move image maps dir from usr to var and symlink it back |
| 72 |
|
|
dodir /var/nagvis/userfiles/images |
| 73 |
|
|
mv "${D}"/usr/share/nagvis/userfiles/images/maps "${D}"/var/nagvis/userfiles/images/ ||die |
| 74 |
|
|
fowners apache:root /var/nagvis/userfiles/images/maps |
| 75 |
|
|
dosym /var/nagvis/userfiles/images/maps /usr/share/nagvis/userfiles/images/maps |
| 76 |
|
|
} |
| 77 |
|
|
|
| 78 |
|
|
pkg_postinst() { |
| 79 |
|
|
elog "Before running NagVis for the first time, you will need to set up" |
| 80 |
|
|
elog "/etc/nagvis/nagvis.ini.php" |
| 81 |
|
|
elog "A sample is in" |
| 82 |
|
|
elog "/etc/nagvis/nagvis.ini.php-sample" |
| 83 |
|
|
if use apache2 ; then |
| 84 |
|
|
elog |
| 85 |
|
|
elog "For web interface make sure to add -D NAGVIS to APACHE2_OPTS in" |
| 86 |
|
|
elog "/etc/conf.d/apache2 and to restart apache2. A default configuration" |
| 87 |
|
|
elog "has been placed at /etc/apache2/modules.d/98_${PN}.conf" |
| 88 |
|
|
fi |
| 89 |
|
|
elog "" |
| 90 |
|
|
elog "Default user/password are: nagiosadmin/nagiosadmin" |
| 91 |
|
|
elog " guest/guest" |
| 92 |
|
|
} |