Ticket #38276: patch-nfsen-Portfile.diff

File patch-nfsen-Portfile.diff, 6.7 KB (added by jul_bsd@…, 10 years ago)
  • net/nfsen//Portfile

    old new  
     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
    12# $Id: Portfile 87391 2011-11-19 06:25:15Z ryandesign@macports.org $
    23
    34PortSystem      1.0
    45
    56name            nfsen
    6 version         1.3
    7 revision        3
     7version         1.3.6p1
     8revision        0
    89categories      net
    910maintainers     markd
    1011license         BSD
     
    1516platforms       darwin
    1617master_sites    sourceforge:project/nfsen/stable/nfsen-${version}
    1718
    18 checksums       md5 1c4f057bbb3766090b40bda3ab6b81d2
     19checksums           rmd160  b7a1c205bbde4276b8ab757c6fb1e69d23b28a5b \
     20                    sha256  810e95546338622756deb919d7ee6c39721bc9873bb75dc7ec411ec0b87e1265
    1921
    20 depends_lib     port:perl5.12 \
     22## rrdtool is 5.16 only, so
     23depends_lib     port:perl5.16 \
    2124                port:rrdtool \
    22                 port:p5.12-mailtools \
    23                 port:p5.12-sys-syslog \
     25                port:p5.16-mailtools \
     26                port:p5.16-sys-syslog \
     27                port:p5.16-socket6 \
    2428                port:nfdump
    2529
    26 patchfiles      patch-install.pl.diff \
    27                 patch-etc-nfsen-dist.conf.diff \
     30startupitem.create      yes
     31startupitem.start       "${prefix}/bin/nfsen start"
     32startupitem.stop        "${prefix}/bin/nfsen stop"
     33startupitem.restart     "${prefix}/bin/nfsen reconfig"
     34
     35if {${subport} eq ${name}} {
     36
     37use_configure   no
     38build {}
     39
     40patchfiles      patch-etc-nfsen-dist.conf.diff \
     41                patch-install.pl.diff \
    2842                patch-libexec-NfSenRC.pm.diff \
    2943                patch-bin-nfsend.diff \
    3044                patch-bin-nfsen.diff \
    3145                patch-bin-testplugin.diff \
    3246                patch-bin-RebuildHierarchy.pl.diff
    33 
    34 use_configure   no
    35 build {}
    36 
    37 startupitem.create      yes
    38 startupitem.executable  ${prefix}/bin/nfsen
     47#        patch-nfsen_php.diff
    3948
    4049post-patch {
    4150# Read the nfsen.conf comments for details on the use of these variables
     
    5867                ${worksrcpath}/install.pl
    5968        eval reinplace "s|__PREFIX__|${prefix}|g" \
    6069                [glob ${worksrcpath}/bin/*]
    61         eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.12|g" \
     70        eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.16|g" \
    6271                [glob ${worksrcpath}/installer-items/*.pm]
    6372}
    6473
     74destroot.asroot     yes
    6575destroot {
    6676# Ugly hack because libexec/NfProfile.pm needs to be rewritten before a DESTDIR variable will work in install.pl.
    6777# But unlike the perl modules, the profiles have no embedded path information so to solve the problem I made
     
    7989# Set profiles-stat and profiles-data to destroot until install is done
    8090        reinplace "s|\${VARDIR}/profiles|${destroot}${prefix}/var/nfsen/profiles|g" \
    8191                ${worksrcpath}/etc/nfsen-dist.conf
    82         system -W ${worksrcpath} "${prefix}/bin/perl5.12 ./install.pl ./etc/nfsen-dist.conf"
     92        ## need root
     93        system -W ${worksrcpath} "${prefix}/bin/perl5.16 ./install.pl ./etc/nfsen-dist.conf"
    8394
    8495# Replace the original .conf file
     96    xinstall -d -m 755 ${destroot}${prefix}/share/examples/${name}/
    8597        file rename -force ${destroot}${prefix}/etc/nfsen-dist.conf.org \
    86                 ${destroot}${prefix}/etc/nfsen-dist.conf
     98                ${destroot}${prefix}/share/examples/${name}/nfsen-dist.conf
    8799
    88100        destroot.keepdirs \
    89101                ${destroot}${prefix}/var/nfsen/run \
    90102                ${destroot}${prefix}/var/nfsen/tmp \
    91103                ${destroot}${prefix}/var/nfsen/filters \
    92104                ${destroot}${prefix}/var/nfsen/fmt
     105
     106    copy ${filespath}/nginx-${name}.conf ${destroot}${prefix}/share/examples/${name}/nginx-${name}.conf.sample
     107
     108    ## patch stuff badly installed ...
     109    delete ${destroot}${prefix}/bin/nfsend.orig ${destroot}${prefix}/etc/nfsen-dist.conf.orig ${destroot}${prefix}/libexec/nfsen/NfSenRC.pm.orig
    93110}
    94111
    95112post-activate {
    96113
    97 ui_msg "\n **** To complete the nfsen installation ****
     114    if ![file exists ${prefix}/etc/nfsen.conf] {
     115        copy ${prefix}/share/examples/${name}/nfsen-dist.conf ${prefix}/etc/nfsen.conf
     116    }
     117    if ![file exists ${prefix}/etc/nginx/nginx-${name}.conf] {
     118        copy ${prefix}/share/examples/${name}/nginx-${name}.conf.sample ${prefix}/etc/nginx/nginx-${name}.conf
     119    }
     120
     121notes "
     122 **** To complete the nfsen installation ****
    98123
    99124To complete the nfsen installation follow the steps below.  Read the documentation
    100125at http://nfsen.sourceforge.net for operational instructions.
    101126
    102127
    103 1) Install PHP (not covered).
     1281) Install PHP (not covered) w php*-sockets.
    104129
    105 2) 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
     1302) In ${prefix}/etc, if not existing, a default nfsen.conf has been created.
     131   The file paths are already set for MacPorts.  Edit it and insert the
    107132   netflow sources you need, and run this command to setup source, RRD, and profiles:
    108133        nfsen reconfig
    109134 
     
    1161414) Start nfsen with the startup script after verifying configuration
    117142        sudo launchctl load -w /Library/LaunchDaemons/org.macports.nfsen.plist
    118143
    119 5) Check the nfsen web interface at http://localhost/nfsen/nfsen.php
     1445) Configure your webserver
     145    Apache
     146    Nginx: if not existing, a sample configuration has been copied to ${prefix}/etc/nginx
     147
     1486) Check the nfsen web interface at http://localhost/nfsen/nfsen.php
     149   If you get a permission error, you may need to
     150        # chmod 666 ${prefix}/var/nfsen/run/nfsen.comm
     151
     152"
     153}
     154
     155}
     156
     157
     158## Broken for now, was working in 5.12, not recognizing prefix now???
     159subport ${name}-devel {
     160
     161    PortGroup   perl5 1.0
    120162
    121 \n"
     163    fetch.type  svn
     164    svn.url     svn://svn.code.sf.net/p/nfsen/code/trunk
     165    svn.revision r27
     166    worksrcdir  trunk
     167    ## using perl Module::Build now, need to decide which perl or multiple variant?
     168    ## +Config::IniHash
     169    depends_build-append    port:p5.16-module-build port:p5.16-file-which
     170
     171    patchfiles
     172    ## FIXME! can't reset the followings: post-patch & destroot?
     173    post-patch {}
     174    configure.cmd     perl5.16
     175    configure.pre_args
     176    configure.args  Build.PL --install_base=${destroot}${prefix}
     177    build.cmd       ./Build
     178    build.target
     179
     180    destroot.cmd     ./Build
     181    destroot.target  install
     182
     183    post-destroot {
     184        move ${destroot}${prefix}/man/man1/nfsen-admin.1pm ${destroot}${prefix}/share/man/man1/
     185        foreach f [glob -directory ${destroot}${prefix}/man/man3 *] {
     186            move ${f} ${destroot}${prefix}/share/man/man3/
     187        }
     188    }
    122189}
    123190
    124191livecheck.regex /${name}-(\[0-9.\]+)${extract.suffix}