source: trunk/dports/net/nfsen/Portfile

Last change on this file was 151872, checked in by mojca@…, 13 months ago

nfsen: switch to perl5.24 (#52081)

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