PortSystem	1.0

name			network-weathermap
version			0.97c
categories		net
maintainers		nomaintainer
platforms		darwin

description		Weathermap is a network visualisation tool, to take graphs you \
                        already have and display an overview of your network as a map. \
			It supports RRD, MRTG (RRD and old log-format), and tab-delimited \
                        text files. Other sources are via plugins or external scripts.

long_description	${description}

homepage		http://www.network-weathermap.com/
master_sites		http://www.network-weathermap.com/files

use_zip			yes
distfiles		php-weathermap-${version}${extract.suffix}
checksums		md5 221f64506abc4d6572774b3fd3d2e2a7 \
			rmd160 76181bfbf6850157265d1851897ada95007c1898
worksrcdir		weathermap

depends_lib		path:bin/perl:perl5 \
			port:cacti

use_configure   no
build {}

set cactidir ${prefix}/share/cacti
set pluginsdir ${cactidir}/plugins

post-patch {
# Set the rrdtool & php paths to point to the MacPorts versions
	reinplace "s|/usr/local|${prefix}|g" \
		${worksrcpath}/weathermap \
		${worksrcpath}/weathermap-cacti-rebuild.php

# Set perl location
	reinplace "s|/usr/bin/perl|${prefix}/bin/perl|g" \
		${worksrcpath}/random-bits/auto-overlib.pl
}

destroot {
	file delete ${worksrcpath}/configs/.htaccess

	file mkdir ${destroot}${pluginsdir}/weathermap
	system "cp -R ${worksrcpath}/* ${destroot}${pluginsdir}/weathermap"

	system "chown -R www:www ${destroot}${pluginsdir}/weathermap/"
}

notes "
**** To complete the Network Weathermap installation ****

To complete the Network Weather Map installation follow the steps below.  Read the documentation
at http://www.cacti.net/documentation.php for operational instructions.


1) Set the PHP path in ${pluginsdir}/weathermap to point to your PHP binary


2) Set Network Weather Map permissions to match the Cacti user permissions
   sudo chown -R <cacti-user>:<cacti-group> ${prefix}/share/${pluginsdir}/weathermap


3) Rename & edit the Network Weathermap Editor's config file
	cd ${pluginsdir}/weathermap
	cp editor-config.php-dist editor-config.php
	nano editor-config.php


4) Set the editor-config.php variables as shown:

	cacti_base = '${cactidir}';
	\$cacti_url = \"http://example.com/cacti/\";


5) Enable the weathermap plugin:

     a) In the Cacti web GUI, go to Configuration -> Plugin Management and you
  should see your plugin(s) listed.
        Under 'Actions', click the the install button to install each plugin.
  
     b) Ensure that your Cacti user has permissions to manage the plugins
  	Console -> User Management  (select Cacti user and allow Conf/Manage and View options)


"