# $Id: Portfile 87391 2011-11-19 06:25:15Z ryandesign@macports.org $ PortSystem 1.0 name nfsen version 1.3 revision 3 categories net maintainers markd license BSD description Web based frontend to nfdump netflow collector long_description ${description} homepage http://nfsen.sourceforge.net/ platforms darwin master_sites sourceforge:project/nfsen/stable/nfsen-${version} checksums md5 1c4f057bbb3766090b40bda3ab6b81d2 depends_lib port:perl5.12 \ port:rrdtool \ port:p5.12-mailtools \ port:p5.12-sys-syslog \ port:nfdump patchfiles patch-install.pl.diff \ patch-etc-nfsen-dist.conf.diff \ patch-libexec-NfSenRC.pm.diff \ patch-bin-nfsend.diff \ patch-bin-nfsen.diff \ patch-bin-testplugin.diff \ patch-bin-RebuildHierarchy.pl.diff use_configure no build {} startupitem.create yes startupitem.executable ${prefix}/bin/nfsen post-patch { # Read the nfsen.conf comments for details on the use of these variables set netflowuser "www" set wwwuser "www" set wwwgroup "www" reinplace "s|__NETFLOWUSER__|${netflowuser}|g" \ ${worksrcpath}/etc/nfsen-dist.conf \ ${worksrcpath}/libexec/NfSenRC.pm reinplace "s|__WWWUSER__|${wwwuser}|g" \ ${worksrcpath}/etc/nfsen-dist.conf reinplace "s|__WWWGROUP__|${wwwgroup}|g" \ ${worksrcpath}/etc/nfsen-dist.conf reinplace "s|__PREFIX__|${prefix}|g" \ ${worksrcpath}/install.pl reinplace "s|__DESTDIR__|${destroot}|g" \ ${worksrcpath}/install.pl eval reinplace "s|__PREFIX__|${prefix}|g" \ [glob ${worksrcpath}/bin/*] eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.12|g" \ [glob ${worksrcpath}/installer-items/*.pm] } destroot { # Ugly hack because libexec/NfProfile.pm needs to be rewritten before a DESTDIR variable will work in install.pl. # But unlike the perl modules, the profiles have no embedded path information so to solve the problem I made # no modifications to install.pl in profile sections. I just backup the .conf file, set the profile directories # to point to destroot, and after the install replace the previous .conf file that points to profiles in PREFIX. # Yuch! I've asked the developers to add DESTDIR support in a future version. reinplace "s|__PREFIX__|${prefix}|g" \ ${worksrcpath}/etc/nfsen-dist.conf # Backup the .conf file file copy ${worksrcpath}/etc/nfsen-dist.conf \ ${worksrcpath}/etc/nfsen-dist.conf.org # Set profiles-stat and profiles-data to destroot until install is done reinplace "s|\${VARDIR}/profiles|${destroot}${prefix}/var/nfsen/profiles|g" \ ${worksrcpath}/etc/nfsen-dist.conf system -W ${worksrcpath} "${prefix}/bin/perl5.12 ./install.pl ./etc/nfsen-dist.conf" # Replace the original .conf file file rename -force ${destroot}${prefix}/etc/nfsen-dist.conf.org \ ${destroot}${prefix}/etc/nfsen-dist.conf destroot.keepdirs \ ${destroot}${prefix}/var/nfsen/run \ ${destroot}${prefix}/var/nfsen/tmp \ ${destroot}${prefix}/var/nfsen/filters \ ${destroot}${prefix}/var/nfsen/fmt } post-activate { ui_msg "\n **** To complete the nfsen installation **** To complete the nfsen installation follow the steps below. Read the documentation at http://nfsen.sourceforge.net for operational instructions. 1) Install PHP (not covered). 2) In ${prefix}/etc, rename the file nfsen-dist.conf to nfsen.conf to make it ready for use; the file paths are already set for MacPorts. Edit it and insert the netflow sources you need, and run this command to setup source, RRD, and profiles: nfsen reconfig 3) Start nfsen manually to test the configuration. nfsen start NOTE: nfsen starts nfcapd (nfdump utility) automatically to capture netflows from your devices based on the sources listed in nfsen.conf. 4) Start nfsen with the startup script after verifying configuration sudo launchctl load -w /Library/LaunchDaemons/org.macports.nfsen.plist 5) Check the nfsen web interface at http://localhost/nfsen/nfsen.php \n" } livecheck.regex /${name}-(\[0-9.\]+)${extract.suffix}