Ticket #56122: Portfile

File Portfile, 7.4 KB (added by pdvnl, 7 years ago)

Portfile with new patch

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
3PortSystem          1.0
4PortGroup           perl5 1.0
5
6name                munin
7version             1.4.7
8revision            6
9license             GPL-2
10categories          net
11maintainers         nomaintainer
12platforms           darwin
13description         Extensible system monitoring tool
14
15long_description    Munin the monitoring tool surveys all your computers \
16                    and remembers what it saw. It presents all the \
17                    information in graphs through a web interface. Its \
18                    emphasis is on plug and play capabilities. Using Munin \
19                    you can easily monitor the performance of your \
20                    computers, networks, SANs, applications, weather \
21                    measurements and whatever comes to mind. \
22                    \
23                    Note: By default only Munin node is installed. To \
24                    install the Munin server that gathers data from \
25                    existing nodes and generates graphs please enable the \
26                    server variant.
27
28homepage            http://munin-monitoring.org/
29master_sites        sourceforge:project/munin/munin%20stable/${version}
30
31checksums           rmd160  b25c0a4d7d7613592757132290b7158228ea2a67 \
32                    sha256  9a87356b1f8662f444a7a2a86ff36809124ffe787c442de0ea35850194d602af
33
34perl5.branches      5.26
35
36depends_lib         port:perl${perl5.major} \
37                    port:p${perl5.major}-module-build \
38                    port:p${perl5.major}-net-server \
39                    port:p${perl5.major}-net-snmp \
40                    port:p${perl5.major}-net-ssleay
41
42# munindoc needs at least groff version 1.20.1 for good Unicode support.
43
44depends_run         port:groff
45
46use_configure       no
47use_parallel_build  no
48patchfiles          patch-Makefile-javaplugin \
49                    patch-Makefile.config \
50                    patch-munin-node.conf.in \
51                    patch-encodings.diff \
52                    pdv-patch-perl5.24-perl5.26
53
54post-patch {
55    reinplace "s|/usr/bin/perl|${perl5.bin}|" \
56        ${worksrcpath}/master/_bin/munin-update.in \
57        ${worksrcpath}/node/extras/munin-node-sched \
58        ${worksrcpath}/node/extras/munin-node-simple.in \
59        ${worksrcpath}/node/bin/munindoc \
60        ${worksrcpath}/contrib/munin-every-services-all-boxes-build-html.in \
61        ${worksrcpath}/node/sbin/munin-node \
62        ${worksrcpath}/node/sbin/munin-node-configure \
63        ${worksrcpath}/node/sbin/munin-run
64}
65
66# sed fails in Mountain Lion, see #36527
67build.env           LANG=C LC_ALL=C
68
69build.target        build
70build.args          PREFIX=${prefix} \
71                    CONFDIR=${prefix}/etc/munin \
72                    DBDIR=${prefix}/var/munin \
73                    LOGDIR=${prefix}/var/log/munin \
74                    STATEDIR=${prefix}/var/run/munin \
75                    MANDIR=${prefix}/share/man \
76                    DOCDIR=${prefix}/share/doc/munin \
77                    LIBDIR=${prefix}/lib/munin \
78                    HTMLDIR=${prefix}/www/munin \
79                    CGIDIR=${prefix}/www/cgi-bin \
80                    PERL=${perl5.bin}
81destroot.args       PREFIX=${destroot}${prefix} \
82                    CONFDIR=${destroot}${prefix}/etc/munin \
83                    DBDIR=${destroot}${prefix}/var/munin \
84                    LOGDIR=${destroot}${prefix}/var/log/munin \
85                    STATEDIR=${destroot}${prefix}/var/run \
86                    MANDIR=${destroot}${prefix}/share/man \
87                    DOCDIR=${destroot}${prefix}/share/doc/munin \
88                    LIBDIR=${destroot}${prefix}/lib/munin \
89                    HTMLDIR=${destroot}${prefix}/www/munin \
90                    CGIDIR=${destroot}${prefix}/www/cgi-bin \
91                    PERL=${perl5.bin}
92destroot.keepdirs   ${destroot}${prefix}/var/log/munin \
93                    ${destroot}${prefix}/var/run/munin \
94                    ${destroot}${prefix}/etc/munin/plugins \
95                    ${destroot}${prefix}/etc/munin/plugin-conf.d \
96                    ${destroot}${prefix}/var/munin \
97                    ${destroot}${prefix}/www/munin
98destroot.target     install-common-prime \
99                    install-node-prime \
100                    install-plugins-prime \
101                    install-plugins-java \
102                    install-man
103
104startupitem.create  yes
105startupitem.name    munin-node
106startupitem.start   "${prefix}/sbin/munin-node"
107startupitem.stop    "kill `cat ${prefix}/var/run/munin/munin-node.pid`"
108
109variant server description {Install Munin server} {
110    depends_lib-append      port:rrdtool \
111                            port:p${perl5.major}-html-template \
112                            port:p${perl5.major}-time-hires \
113                            port:p${perl5.major}-digest-md5 \
114                            port:p${perl5.major}-text-balanced \
115                            port:p${perl5.major}-log-log4perl
116    destroot.target-append  install-master-prime
117}
118
119pre-destroot {
120    # Create munin user and group
121    addgroup munin
122    adduser munin gid=[existsgroup munin]
123}
124post-destroot {
125    # Rename config files so port upgrades don't overwrite installed versions of these
126    file rename ${destroot}${prefix}/etc/munin/munin-node.conf ${destroot}${prefix}/etc/munin/munin-node.conf.sample
127
128    # State directory should be owned by munin
129    xinstall -d -o munin ${destroot}${prefix}/var/run/munin
130
131    if { [variant_isset server] } {
132        file rename ${destroot}${prefix}/etc/munin/munin.conf ${destroot}${prefix}/etc/munin/munin.conf.sample
133        # Create and symlink launchd item for munin-cron
134        xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.munin-cron
135        file copy ${portpath}/files/org.macports.munin-cron.plist.in \
136        ${destroot}${prefix}/etc/LaunchDaemons/org.macports.munin-cron/org.macports.munin-cron.plist
137        reinplace s|@PREFIX@|${prefix}|g ${destroot}${prefix}/etc/LaunchDaemons/org.macports.munin-cron/org.macports.munin-cron.plist
138
139        xinstall -d ${destroot}/Library/LaunchDaemons
140        ln -s ${prefix}/etc/LaunchDaemons/org.macports.munin-cron/org.macports.munin-cron.plist \
141        ${destroot}/Library/LaunchDaemons/org.macports.munin-cron.plist
142
143        ui_msg "###########################################################"
144        ui_msg "# A startup item has been generated that will cause the"
145        ui_msg "# Munin server to fetch data from all nodes every 5 mins."
146        ui_msg "# It is disabled by default, please execute the following"
147        ui_msg "# command to enable:"
148        ui_msg "#"
149        ui_msg "# sudo launchctl load -w /Library/LaunchDaemons/org.macports.munin-cron.plist"
150        ui_msg "###########################################################"
151    }
152}
153
154post-activate {
155    # Copy sample versions of config files into place
156    if {![file exists ${prefix}/etc/munin/munin-node.conf]} {
157        file copy ${prefix}/etc/munin/munin-node.conf.sample ${prefix}/etc/munin/munin-node.conf
158    }
159    if { [variant_isset server] } {
160        if {![file exists ${prefix}/etc/munin/munin.conf]} {
161            file copy ${prefix}/etc/munin/munin.conf.sample ${prefix}/etc/munin/munin.conf
162        }
163    }
164}
165
166notes "
167To detect supported Munin plugins please use the following command:
168
169sudo -u munin munin-node-configure --suggest --shell | sudo sh
170"
171
172livecheck.regex ${name}-(\[0-9\]+\\.\[0-9\]*\[02468\](\\.\[0-9\]+)*)${extract.suffix}