[34065] trunk/dports/net
markd at macports.org
markd at macports.org
Mon Feb 11 12:02:11 PST 2008
Revision: 34065
http://trac.macosforge.org/projects/macports/changeset/34065
Author: markd at macports.org
Date: 2008-02-11 12:02:11 -0800 (Mon, 11 Feb 2008)
Log Message:
-----------
New port nfsen.
Added Paths:
-----------
trunk/dports/net/nfsen/
trunk/dports/net/nfsen/Portfile
trunk/dports/net/nfsen/files/
trunk/dports/net/nfsen/files/patch-bin-RebuildHierarchy.pl.diff
trunk/dports/net/nfsen/files/patch-bin-nfsen.diff
trunk/dports/net/nfsen/files/patch-bin-nfsend.diff
trunk/dports/net/nfsen/files/patch-bin-testplugin.diff
trunk/dports/net/nfsen/files/patch-etc-nfsen-dist.conf.diff
trunk/dports/net/nfsen/files/patch-install.pl.diff
trunk/dports/net/nfsen/files/patch-libexec-NfSenRC.pm.diff
Added: trunk/dports/net/nfsen/Portfile
===================================================================
--- trunk/dports/net/nfsen/Portfile (rev 0)
+++ trunk/dports/net/nfsen/Portfile 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,111 @@
+# $Id$
+
+PortSystem 1.0
+
+name nfsen
+version 1.3
+categories net
+maintainers markd
+description Web based frontend to nfdump netflow collector
+long_description ${description}
+homepage http://nfsen.sourceforge.net/
+platforms darwin
+master_sites sourceforge \
+ http://nfsen.sourceforge.net/
+checksums md5 1c4f057bbb3766090b40bda3ab6b81d2
+
+depends_lib port:perl5.8 \
+ port:rrdtool \
+ port:p5-mailtools \
+ port:p5-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 {
+
+set netflowuser "www"
+
+ 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/*]
+ reinplace "s|__NETFLOWUSER__|${netflowuser}|g" \
+ ${worksrcpath}/etc/nfsen-dist.conf \
+ ${worksrcpath}/libexec/NfSenRC.pm
+ eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl|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 "${prefix}/bin/perl ${worksrcpath}/install.pl ${worksrcpath}/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
+
+7) Check the nfsen web interface at http://localhost/nfsen/nfsen.php
+
+\n"
+}
Property changes on: trunk/dports/net/nfsen/Portfile
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/dports/net/nfsen/files/patch-bin-RebuildHierarchy.pl.diff
===================================================================
--- trunk/dports/net/nfsen/files/patch-bin-RebuildHierarchy.pl.diff (rev 0)
+++ trunk/dports/net/nfsen/files/patch-bin-RebuildHierarchy.pl.diff 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,8 @@
+--- bin/RebuildHierarchy.pl.org 2007-07-20 05:33:21.000000000 -0700
++++ bin/RebuildHierarchy.pl 2008-02-08 10:01:29.000000000 -0800
+@@ -1,4 +1,4 @@
+-#!%%PERL%% -w
++#!__PREFIX__/bin/perl -w -I __PREFIX__/libexec/nfsen
+ #
+ #
+ # Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
Added: trunk/dports/net/nfsen/files/patch-bin-nfsen.diff
===================================================================
--- trunk/dports/net/nfsen/files/patch-bin-nfsen.diff (rev 0)
+++ trunk/dports/net/nfsen/files/patch-bin-nfsen.diff 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,8 @@
+--- bin/nfsen.org 2008-02-08 09:57:18.000000000 -0800
++++ bin/nfsen 2008-02-08 09:57:44.000000000 -0800
+@@ -1,4 +1,4 @@
+-#!%%PERL%% -w
++#!__PREFIX__/bin/perl -w -I __PREFIX__/libexec/nfsen
+ #
+ # Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
+ # All rights reserved.
Added: trunk/dports/net/nfsen/files/patch-bin-nfsend.diff
===================================================================
--- trunk/dports/net/nfsen/files/patch-bin-nfsend.diff (rev 0)
+++ trunk/dports/net/nfsen/files/patch-bin-nfsend.diff 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,21 @@
+--- bin/nfsend.org 2007-11-20 04:27:39.000000000 -0800
++++ bin/nfsend 2008-02-08 09:59:40.000000000 -0800
+@@ -1,4 +1,4 @@
+-#!%%PERL%% -w
++#!__PREFIX__/bin/perl -w -I __PREFIX__/libexec/nfsen
+ #
+ # Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
+ # All rights reserved.
+@@ -703,9 +703,9 @@
+ $arg = '' unless defined $arg;
+ die "Unknow argument '$arg'" if $arg ne '' && $arg ne 'once';
+
+-if ( !NfSen::DropPriv($NfConf::USER) ) {
+- die "$Log::ERROR\n";
+-}
++#if ( !NfSen::DropPriv($NfConf::USER) ) {
++# die "$Log::ERROR\n";
++#}
+
+ $semlock = semget(IPC_PRIVATE, 1, 0600 | IPC_CREAT ) || die "Can not get semaphore: $!";
+ semsignal($semlock);
Added: trunk/dports/net/nfsen/files/patch-bin-testplugin.diff
===================================================================
--- trunk/dports/net/nfsen/files/patch-bin-testplugin.diff (rev 0)
+++ trunk/dports/net/nfsen/files/patch-bin-testplugin.diff 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,8 @@
+--- bin/testPlugin.org 2007-08-24 09:56:26.000000000 -0700
++++ bin/testPlugin 2008-02-08 10:02:43.000000000 -0800
+@@ -1,4 +1,4 @@
+-#!%%PERL%% -w
++#!__PREFIX__/bin/perl -w -I __PREFIX__/libexec/nfsen
+ #
+ # Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
+ # All rights reserved.
Added: trunk/dports/net/nfsen/files/patch-etc-nfsen-dist.conf.diff
===================================================================
--- trunk/dports/net/nfsen/files/patch-etc-nfsen-dist.conf.diff (rev 0)
+++ trunk/dports/net/nfsen/files/patch-etc-nfsen-dist.conf.diff 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,84 @@
+--- etc/nfsen-dist.conf.org 2007-11-20 04:27:39.000000000 -0800
++++ etc/nfsen-dist.conf 2008-02-07 22:07:02.000000000 -0800
+@@ -18,7 +18,7 @@
+
+ #
+ # Required for default layout
+-$BASEDIR = "/data/nfsen";
++$BASEDIR = "__PREFIX__";
+
+ #
+ # Where to install the NfSen binaries
+@@ -26,7 +26,7 @@
+
+ #
+ # Where to install the NfSen Perl modules
+-$LIBEXECDIR="${BASEDIR}/libexec";
++$LIBEXECDIR="${BASEDIR}/libexec/nfsen";
+
+ #
+ # Where to install the config files
+@@ -36,7 +36,7 @@
+ # NfSen html pages directory:
+ # All php scripts will be installed here.
+ # URL: Entry point for nfsen: http://<webserver>/nfsen/nfsen.php
+-$HTMLDIR = "/var/www/nfsen/";
++$HTMLDIR = "${BASEDIR}/www/nfsen/";
+
+ #
+ # Where to install the docs
+@@ -44,7 +44,7 @@
+
+ #
+ # Var space for NfSen
+-$VARDIR="${BASEDIR}/var";
++$VARDIR="${BASEDIR}/var/nfsen";
+
+ #
+ # directory for all pid files
+@@ -53,15 +53,15 @@
+ #
+ # The Profiles stat directory, where all profile information
+ # RRD DBs and png pictures of the profile are stored
+-$PROFILESTATDIR="${BASEDIR}/profiles-stat";
++$PROFILESTATDIR="${VARDIR}/profiles-stat";
+
+ #
+ # The Profiles directory, where all netflow data is stored
+-$PROFILEDATADIR="${BASEDIR}/profiles-data";
++$PROFILEDATADIR="${VARDIR}/profiles-data";
+
+ #
+ # Where go all the backend plugins
+-$BACKEND_PLUGINDIR="${BASEDIR}/plugins";
++$BACKEND_PLUGINDIR="${LIBEXECDIR}/plugins";
+
+ #
+ # Where go all the frontend plugins
+@@ -69,7 +69,7 @@
+
+ #
+ # nfdump tools path
+-$PREFIX = '/usr/local/bin';
++$PREFIX = '__PREFIX__/bin';
+
+ #
+ # nfsend communication socket
+@@ -81,7 +81,7 @@
+ # This may be a different or the same uid than your web server.
+ # Note: This user must be in group $WWWGROUP, otherwise nfcapd
+ # is not able to write data files!
+-$USER = "netflow";
++$USER = "__NETFLOWUSER__";
+
+ # user and group of the web server process
+ # All netflow processing will be done with this user
+@@ -136,7 +136,7 @@
+
+ %sources = (
+ 'upstream1' => { 'port' => '9995', 'col' => '#0000ff', 'type' => 'netflow' },
+- 'peer1' => { 'port' => '9996', 'col' => '#ff0000' },
++# 'peer1' => { 'port' => '9996', 'col' => '#ff0000' },
+ );
+
+ #
Added: trunk/dports/net/nfsen/files/patch-install.pl.diff
===================================================================
--- trunk/dports/net/nfsen/files/patch-install.pl.diff (rev 0)
+++ trunk/dports/net/nfsen/files/patch-install.pl.diff 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,97 @@
+--- install.pl.org 2007-11-21 01:12:04.000000000 -0800
++++ install.pl 2008-02-09 20:52:23.000000000 -0800
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!__PREFIX__/bin/perl -I __PREFIX__/libexec/nfsen -I __DESTROOT____PREFIX__/libexec/nfsen
+ #
+ #
+ # Copyright (c) 2004, SWITCH - Teleinformatikdienste fuer Lehre und Forschung
+@@ -283,8 +283,8 @@
+ sub PatchAllScripts {
+
+ my %GlobList = (
+- "bin/*" => "$NfConf::BINDIR",
+- "libexec/*" => "$NfConf::LIBEXECDIR"
++ "bin/*" => "__DESTDIR____PREFIX__/bin",
++ "libexec/*" => "__DESTDIR____PREFIX__/libexec/nfsen"
+ );
+
+ foreach my $glob_list ( keys %GlobList ) {
+@@ -334,15 +334,14 @@
+ my ( $nfsen_uid, $www_gid ) = @_;
+
+ print "Setup php and html files.\n";
+- mkdir "$NfConf::HTMLDIR" unless -d "$NfConf::HTMLDIR";
+- die "Could not create HTMl directory '$NfConf::HTMLDIR': $!\n" unless -d $NfConf::HTMLDIR;
++ mkdir "__DESTDIR____PREFIX__/www/nfsen";
+
+ $CopyRecursive::CopyLink = 1;
+ $CopyRecursive::MODE = 0644;
+ $CopyRecursive::UID = 0;
+ $CopyRecursive::GID = $www_gid;
+- CopyRecursive::dircopy("html", "$NfConf::HTMLDIR");
+- open CONF, ">$NfConf::HTMLDIR/conf.php" || die "Can't open conf.php for writing: $!\n";
++ CopyRecursive::dircopy("html", "__DESTDIR____PREFIX__/www/nfsen");
++ open CONF, ">__DESTDIR____PREFIX__/www/nfsen/conf.php" || die "Can't open conf.php for writing: $!\n";
+ print CONF "<?\n";
+ print CONF "/* This file was automatically created by the NfSen install.pl script */\n\n";
+ print CONF "\$COMMSOCKET = \"$NfConf::COMMSOCKET\";\n";
+@@ -362,11 +361,11 @@
+ umask 0002;
+ print "\nSetup diretories:\n";
+ my @dirs = (
+- "$NfConf::VARDIR",
+- "$NfConf::PIDDIR",
+- "$NfConf::VARDIR/tmp",
+- "$NfConf::VARDIR/filters",
+- "$NfConf::VARDIR/fmt",
++ "__DESTDIR____PREFIX__/var/nfsen",
++ "__DESTDIR____PREFIX__/var/nfsen/run",
++ "__DESTDIR____PREFIX__/var/nfsen/tmp",
++ "__DESTDIR____PREFIX__/var/nfsen/filters",
++ "__DESTDIR____PREFIX__/var/nfsen/fmt",
+ "$NfConf::PROFILESTATDIR",
+ "$NfConf::PROFILESTATDIR/live",
+ "$NfConf::PROFILEDATADIR",
+@@ -585,21 +584,15 @@
+ $CopyRecursive::UID = 0;
+ $CopyRecursive::GID = $www_gid;
+ $CopyRecursive::MODE = 0755;
+- unlink "$NfConf::BINDIR/nfsen.rc";
+- CopyRecursive::dircopy("bin", "$NfConf::BINDIR");
+- CopyRecursive::dircopy("libexec", "$NfConf::LIBEXECDIR");
++ unlink "__DESTDIR____PREFIX__/bin/nfsen.rc";
++ CopyRecursive::dircopy("bin", "__DESTDIR____PREFIX__/bin");
++ CopyRecursive::dircopy("libexec", "__DESTDIR____PREFIX__/libexec/nfsen");
+ $CopyRecursive::MODE = 0644;
+- CopyRecursive::dircopy("etc", "$NfConf::CONFDIR");
+- CopyRecursive::dircopy("plugins/backend", "$NfConf::BACKEND_PLUGINDIR");
+- CopyRecursive::dircopy("plugins/frontend", "$NfConf::FRONTEND_PLUGINDIR");
+- CopyRecursive::dircopy("doc", "$NfConf::DOCDIR");
++ CopyRecursive::dircopy("etc", "__DESTDIR____PREFIX__/etc");
++ CopyRecursive::dircopy("plugins/backend", "__DESTDIR____PREFIX__/libexec/nfsen/plugins");
++ CopyRecursive::dircopy("plugins/frontend", "__DESTDIR____PREFIX__/www/nfsen/plugins");
++ CopyRecursive::dircopy("doc", "__DESTDIR____PREFIX__/www/nfsen/doc");
+
+- if ( $ConfigFile eq "$NfConf::CONFDIR/nfsen.conf" ) {
+- print "Keep config file '$ConfigFile'\n";
+- } else {
+- print "Copy config file '$ConfigFile'\n";
+- CopyRecursive::fcopy("$ConfigFile", "$NfConf::CONFDIR/nfsen.conf");
+- }
+ print "\n";
+
+ } # End of CopyAllFiles
+@@ -669,12 +662,6 @@
+ exit 1;
+ }
+
+-# check for extra errornoous nfsen.conf file, which may overwrite existing files
+-if ( -f "$NfConf::CONFDIR/nfsen.conf" && -f "etc/nfsen.conf" &&
+- ( (stat($ConfigFile))[1] != (stat("etc/nfsen.conf"))[1] )) {
+- die "Extra nfsen.conf file in etc directory found. Remove errornous file first"
+-}
+-
+ my $hints = NfSen::LoadHints();
+ if ( $$$hints{'version'} == -1 ) {
+ # initial NfSen install or upgrade from old version without hints
Added: trunk/dports/net/nfsen/files/patch-libexec-NfSenRC.pm.diff
===================================================================
--- trunk/dports/net/nfsen/files/patch-libexec-NfSenRC.pm.diff (rev 0)
+++ trunk/dports/net/nfsen/files/patch-libexec-NfSenRC.pm.diff 2008-02-11 20:02:11 UTC (rev 34065)
@@ -0,0 +1,11 @@
+--- libexec/NfSenRC.pm.org 2007-11-20 04:27:39.000000000 -0800
++++ libexec/NfSenRC.pm 2008-02-07 22:18:47.000000000 -0800
+@@ -158,7 +158,7 @@
+ print ".\n";
+
+ print "Starting nfsend";
+- system "$NfConf::BINDIR/nfsend";
++ system "/usr/bin/su __NETFLOWUSER__ -c $NfConf::BINDIR/nfsend";
+ my $exit_value = $main::child_exit >> 8;
+ my $signal_num = $main::child_exit & 127;
+ my $dumped_core = $main::child_exit & 128;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080211/3409a221/attachment.html
More information about the macports-changes
mailing list