source: trunk/dports/net/nfsen/Portfile @ 87391

Last change on this file since 87391 was 87391, checked in by ryandesign@…, 7 years ago

nfsen: fix livecheck (#22923); rewrite master_sites to avoid redirects

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1# $Id: Portfile 87391 2011-11-19 06:25:15Z ryandesign@macports.org $
2
3PortSystem      1.0
4
5name            nfsen
6version         1.3
7revision        3
8categories      net
9maintainers     markd
10license         BSD
11
12description     Web based frontend to nfdump netflow collector
13long_description ${description}
14homepage        http://nfsen.sourceforge.net/
15platforms       darwin
16master_sites    sourceforge:project/nfsen/stable/nfsen-${version}
17
18checksums       md5 1c4f057bbb3766090b40bda3ab6b81d2
19
20depends_lib     port:perl5.12 \
21                port:rrdtool \
22                port:p5.12-mailtools \
23                port:p5.12-sys-syslog \
24                port:nfdump
25
26patchfiles      patch-install.pl.diff \
27                patch-etc-nfsen-dist.conf.diff \
28                patch-libexec-NfSenRC.pm.diff \
29                patch-bin-nfsend.diff \
30                patch-bin-nfsen.diff \
31                patch-bin-testplugin.diff \
32                patch-bin-RebuildHierarchy.pl.diff
33
34use_configure   no
35build {}
36
37startupitem.create      yes
38startupitem.executable  ${prefix}/bin/nfsen
39
40post-patch {
41# Read the nfsen.conf comments for details on the use of these variables
42
43set netflowuser "www"
44set wwwuser "www"
45set wwwgroup "www"
46
47        reinplace "s|__NETFLOWUSER__|${netflowuser}|g" \
48                ${worksrcpath}/etc/nfsen-dist.conf \
49                ${worksrcpath}/libexec/NfSenRC.pm
50        reinplace "s|__WWWUSER__|${wwwuser}|g" \
51                ${worksrcpath}/etc/nfsen-dist.conf
52        reinplace "s|__WWWGROUP__|${wwwgroup}|g" \
53                ${worksrcpath}/etc/nfsen-dist.conf
54
55        reinplace "s|__PREFIX__|${prefix}|g" \
56                ${worksrcpath}/install.pl
57        reinplace "s|__DESTDIR__|${destroot}|g" \
58                ${worksrcpath}/install.pl
59        eval reinplace "s|__PREFIX__|${prefix}|g" \
60                [glob ${worksrcpath}/bin/*]
61        eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.12|g" \
62                [glob ${worksrcpath}/installer-items/*.pm]
63}
64
65destroot {
66# Ugly hack because libexec/NfProfile.pm needs to be rewritten before a DESTDIR variable will work in install.pl.
67# But unlike the perl modules, the profiles have no embedded path information so to solve the problem I made
68# no modifications to install.pl in profile sections.  I just backup the .conf file, set the profile directories
69# to point to destroot, and after the install replace the previous .conf file that points to profiles in PREFIX.
70# Yuch!  I've asked the developers to add DESTDIR support in a future version.
71
72        reinplace "s|__PREFIX__|${prefix}|g" \
73                ${worksrcpath}/etc/nfsen-dist.conf
74
75# Backup the .conf file
76        file copy ${worksrcpath}/etc/nfsen-dist.conf \
77                ${worksrcpath}/etc/nfsen-dist.conf.org
78
79# Set profiles-stat and profiles-data to destroot until install is done
80        reinplace "s|\${VARDIR}/profiles|${destroot}${prefix}/var/nfsen/profiles|g" \
81                ${worksrcpath}/etc/nfsen-dist.conf
82        system -W ${worksrcpath} "${prefix}/bin/perl5.12 ./install.pl ./etc/nfsen-dist.conf"
83
84# Replace the original .conf file
85        file rename -force ${destroot}${prefix}/etc/nfsen-dist.conf.org \
86                ${destroot}${prefix}/etc/nfsen-dist.conf
87
88        destroot.keepdirs \
89                ${destroot}${prefix}/var/nfsen/run \
90                ${destroot}${prefix}/var/nfsen/tmp \
91                ${destroot}${prefix}/var/nfsen/filters \
92                ${destroot}${prefix}/var/nfsen/fmt
93}
94
95post-activate {
96
97ui_msg "\n **** To complete the nfsen installation ****
98
99To complete the nfsen installation follow the steps below.  Read the documentation
100at http://nfsen.sourceforge.net for operational instructions.
101
102
1031) Install PHP (not covered).
104
1052) In ${prefix}/etc, rename the file nfsen-dist.conf to nfsen.conf to make it ready
106   for use; the file paths are already set for MacPorts.  Edit it and insert the
107   netflow sources you need, and run this command to setup source, RRD, and profiles:
108        nfsen reconfig
109 
1103) Start nfsen manually to test the configuration.
111        nfsen start
112
113   NOTE: nfsen starts nfcapd (nfdump utility) automatically to capture netflows from your devices
114         based on the sources listed in nfsen.conf.
115
1164) Start nfsen with the startup script after verifying configuration
117        sudo launchctl load -w /Library/LaunchDaemons/org.macports.nfsen.plist
118
1195) Check the nfsen web interface at http://localhost/nfsen/nfsen.php
120
121\n"
122}
123
124livecheck.regex /${name}-(\[0-9.\]+)${extract.suffix}
Note: See TracBrowser for help on using the repository browser.