source: trunk/dports/net/vnstat/Portfile

Last change on this file was 139348, checked in by khindenburg@…, 2 years ago

vnstat: upgrade to 1.14; adjust install conf file; new maintainer #48497

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.7 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 139348 2015-08-14 03:12:51Z ryandesign@macports.org $
3
4PortSystem 1.0
5
6name                vnstat
7version             1.14
8categories          net
9platforms           darwin
10maintainers         gmail.com:youvegotmoxie
11license             GPL-2
12description         console-based network traffic monitor
13long_description    \
14    vnStat is a console-based network traffic monitor for Linux and BSD that keeps \
15    a log of network traffic for the selected interface(s), it uses the network \
16    interface statistics provided by the kernel as information source.  This means \
17    that vnStat won't actually be sniffing any traffic and also ensures light use \
18    of system resources.
19
20homepage            http://humdi.net/vnstat/
21depends_lib         port:gd2
22master_sites        http://humdi.net/${name}
23
24checksums           rmd160  9cbe5d4f11d757ae19db4b38155de63a8caf6164 \
25                    sha256  f8462a47d85d0890493dc9eaeafbc725ae631aa5b103fb7f8af4ddb2314e8386
26
27post-patch {
28    # fix Makefile
29    reinplace "s|/usr/local|${prefix}|g"                 ${worksrcpath}/Makefile
30    reinplace "s|${prefix}/man|${prefix}/share/man|g"    ${worksrcpath}/Makefile
31    reinplace "s|(DESTDIR)/etc|(DESTDIR)${prefix}/etc|g" ${worksrcpath}/Makefile
32    reinplace "s|(DESTDIR)/var|(DESTDIR)${prefix}/var|g" ${worksrcpath}/Makefile
33
34    # fix occurrences of /var/db references in other files
35    reinplace "s|/var|${prefix}/var|g"  ${worksrcpath}/src/common.h \
36                                        ${worksrcpath}/cfg/vnstat.conf \
37                                        ${worksrcpath}/man/vnstat.1 \
38                                        ${worksrcpath}/man/vnstatd.1 \
39                                        ${worksrcpath}/man/vnstati.1
40    reinplace "s|/var/lib|/var/db|g"    ${worksrcpath}/man/vnstat.1 \
41                                        ${worksrcpath}/man/vnstatd.1 \
42                                        ${worksrcpath}/man/vnstati.1
43
44    # fix occurrences of /etc/db references in other files
45    reinplace "s|/etc|${prefix}/etc|g"  ${worksrcpath}/man/vnstat.1 \
46                                        ${worksrcpath}/man/vnstat.conf.5 \
47                                        ${worksrcpath}/man/vnstatd.1 \
48                                        ${worksrcpath}/man/vnstati.1 \
49                                        ${worksrcpath}/src/cfg.c
50}
51
52use_configure       no
53variant universal   {}
54
55build.args-append   CC="${configure.cc} [get_canonical_archflags]" \
56                    CPP=${configure.cpp} \
57                    CFLAGS="-I${prefix}/include" \
58                    LDFLAGS="-L${prefix}/lib"
59
60destroot.target     bsdinstall
61destroot.keepdirs   ${destroot}${prefix}/var/db/vnstat
62post-destroot {
63    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
64    xinstall -m 755 -d ${destroot}${prefix}/share/examples/${name}
65   
66    xinstall -m 644 -W ${worksrcpath} \
67        CHANGES COPYING FAQ INSTALL INSTALL_BSD README \
68        ${destroot}${prefix}/share/doc/${name}
69
70    eval file copy [glob ${worksrcpath}/examples/*] \
71        ${destroot}${prefix}/share/examples/${name}
72
73    # Rename conf file so we don't clobber a user's real conf file on upgrade.
74    move ${destroot}${prefix}/etc/vnstat.conf ${destroot}${prefix}/etc/vnstat.conf.sample
75}
76
77notes "
78A configuration file has been installed to ${prefix}/etc/vnstat.conf
79"
80
81pre-activate {
82    if {[file exists ${prefix}/etc/vnstat.conf]} {
83        # Clear the notes if there is already a conf file
84        notes
85    }
86}
87
88post-activate {
89    if {![file exists ${prefix}/etc/vnstat.conf]} {
90        copy ${prefix}/etc/vnstat.conf.sample \
91            ${prefix}/etc/vnstat.conf
92    }
93}
Note: See TracBrowser for help on using the repository browser.