Ticket #26175: Portfile

File Portfile, 8.3 KB (added by fclaire@…, 14 years ago)
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$
3
4PortSystem              1.0
5
6name                    xymon-server
7set shortname           xymon
8conflicts               xymon
9version                 4.3.0.beta3
10categories              net
11platforms               darwin
12maintainers             free.fr:fclaire
13
14description             Xymon network monitor Server
15
16long_description        Xymon is a system for monitoring of hosts and networks, \
17                        inspired by the Big Brother system. It provides real-time \
18                        monitoring, an easy web-interface, historical data, \
19                        availability reports and performance graphs. \
20                        Xymon was previously known as \"Hobbit\".
21
22homepage                http://www.xymon.com/
23master_sites            sourceforge:${shortname}
24distname                ${shortname}-${version}
25dist_subdir             ${shortname}
26
27checksums               md5 1d400f81ef5a30c8908a452dab7ba7cf \
28                        sha1 45e9957d71edc2dfc94702e40aa81f4efcf5893f \
29                        rmd160 4343c7fd1da4872d0e21066ec567cd90e8078613
30
31depends_lib             port:rrdtool \
32                        port:fping \
33                        port:pcre \
34                        port:libpng \
35                        port:openssl \
36                        port:openldap
37
38patchfiles              patch-build-Makefile.rules.diff \
39                        patch-lib-Makefile.diff \
40                        patch-client-xymonclient-darwin.sh.diff
41
42if {"darwin" == ${os.platform} && ${os.major} > 8} {
43    set xymonuser       _xymon
44} else {
45    set xymonuser       xymon
46}
47set xymongroup          ${xymonuser}
48set xytopdir            ${prefix}/lib/${shortname}
49set xyetcdir            ${xytopdir}/etc
50set xybindir            ${xytopdir}/server/bin
51set xylogdir            ${prefix}/var/log/${shortname}
52set xytmpdir            ${xytopdir}/tmp
53set xyvardir            ${xytopdir}/data
54set xywebdir            ${xytopdir}/web
55set xywwwdir            ${xytopdir}/www
56
57configure.cmd           ./configure.server
58configure.args-append   --rrdinclude ${prefix}/include \
59                        --rrdlib ${prefix}/lib \
60                        --pcreinclude ${prefix}/include \
61                        --pcrelib ${prefix}/lib \
62                        --sslinclude ${prefix}/include \
63                        --ssllib ${prefix}/lib \
64                        --ldapinclude ${prefix}/include \
65                        --ldaplib ${prefix}/lib \
66                        --fping ${prefix}/sbin/fping
67configure.env-append    ENABLESSL=y \
68                        ENABLELDAP=y \
69                        ENABLELDAPSSL=y \
70                        XYMONUSER=${xymonuser} \
71                        USEXYMONPING=n \
72                        XYMONTOPDIR=${xytopdir} \
73                        XYMONHOSTURL=/${shortname} \
74                        CGIDIR=${xytopdir}/cgi-bin \
75                        XYMONCGIURL=/${shortname}-cgi \
76                        SECURECGIDIR=${xytopdir}/cgi-secure \
77                        SECUREXYMONCGIURL=/${shortname}-secgci \
78                        HTTPDGID=_www \
79                        XYMONLOGDIR=${xylogdir} \
80                        XYMONHOSTNAME=localhost \
81                        XYMONHOSTIP=127.0.0.1 \
82                        XYMONHOSTOS=${os.platform} \
83                        MANROOT=${prefix}/share/man \
84                        INSTALLBINDIR=${xytopdir}/server/bin \
85                        INSTALLETCDIR=${xyetcdir} \
86                        INSTALLEXTDIR=${xytopdir}/server/ext \
87                        INSTALLTMPDIR=${xytmpdir} \
88                        INSTALLWEBDIR=${xywebdir} \
89                        INSTALLWWWDIR=${xywwwdir} \
90                        XYMONVAR=${xyvardir}
91
92destroot.env-append     INSTALLROOT=${destroot}
93destroot.keepdirs       ${destroot}${xytopdir} \
94                        ${destroot}${xylogdir} \
95                        ${destroot}${xytmpdir} \
96                        ${destroot}${xyvardir}/acks \
97                        ${destroot}${xyvardir}/data \
98                        ${destroot}${xyvardir}/disabled \
99                        ${destroot}${xyvardir}/hist \
100                        ${destroot}${xyvardir}/histlogs \
101                        ${destroot}${xyvardir}/hostdata \
102                        ${destroot}${xyvardir}/logs \
103                        ${destroot}${xyvardir}/rrd \
104                        ${destroot}${xyvardir} \
105                        ${destroot}${xywebdir} \
106                        ${destroot}${xywwwdir}/html \
107                        ${destroot}${xywwwdir}/rep \
108                        ${destroot}${xywwwdir}/snap \
109                        ${destroot}${xywwwdir}/notes \
110                        ${destroot}${xywwwdir}/wml
111
112pre-destroot {
113    addgroup ${xymongroup}
114    adduser ${xymonuser} gid=[existsgroup ${xymongroup}] realname=Xymon\ User home=${xytopdir} shell=/bin/bash
115}
116
117post-destroot {
118    # Adding own startupitem - xymon needs to be run under ${xymonuser} user
119    xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/
120    xinstall -m 644 ${filespath}/org.macports.${name}.plist ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/
121    # The startup script needs to be adapted to use ${xymonuser} user
122    reinplace s%@XYMONUSER@%${xymonuser}%g ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
123    reinplace s%@XYMONLAUNCH@%${xybindir}/xymonlaunch%g ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
124    reinplace s%@XYMONTASKS@%${xyetcdir}/tasks.cfg%g ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
125    reinplace s%@XYMONSERVER@%${xyetcdir}/xymonserver.cfg%g ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
126    reinplace s%@XYMONLAUNCHLOG@%${xylogdir}/xymonlaunch.log%g ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
127    reinplace s%@XYMONLAUNCHPID@%${xylogdir}/xymonlaunch.pid%g ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist
128
129    # Creation of a symbolic link towards startupitem
130    xinstall -d -m 755 ${destroot}/Library/LaunchDaemons
131    ln -sf ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist ${destroot}/Library/LaunchDaemons/
132    # And a link to have the xymon client working
133    ln -sf ${xytmpdir} ${destroot}${xytopdir}/client/
134
135    # Adding a suffix to config files
136    foreach f { alerts.cfg analysis.cfg cgioptions.cfg client-local.cfg columndoc.csv combo.cfg critical.cfg graphs.cfg holidays.cfg \
137                hosts.cfg protocols.cfg rrddefinitions.cfg snmpmibs.cfg tasks.cfg xymon-apache.conf xymonmenu.cfg xymonserver.cfg } {
138        move ${destroot}${xyetcdir}/${f} ${destroot}${xyetcdir}/${f}.${version}
139    }
140}
141
142post-activate {
143    # If not already present we put default config files
144    foreach f { alerts.cfg analysis.cfg cgioptions.cfg client-local.cfg columndoc.csv combo.cfg critical.cfg graphs.cfg holidays.cfg \
145                hosts.cfg protocols.cfg rrddefinitions.cfg snmpmibs.cfg tasks.cfg xymon-apache.conf xymonmenu.cfg xymonserver.cfg } {
146        if {![file exists ${xyetcdir}/${f}]} {
147            file copy ${xyetcdir}/${f}.${version} ${xyetcdir}/${f}
148            system "chown ${xymonuser} ${xyetcdir}/${f}"
149        }
150    }
151}
152
153notes "  *** To complete the Xymon install ***
154
155Run the following commands in your terminal:
156    $ sudo echo \"kern.sysv.shmmni=64\" >> /etc/sysctl.conf
157    $ sudo echo \"kern.sysv.shmseg=12\" >> /etc/sysctl.conf
158    $ sudo mv ${xyetcdir}/xymon-apache.conf /etc/apache2/\[other|sites\]/
159    $ sudo /usr/sbin/apachectl restart
160    $ sudo dscl . -append /Groups/admin GroupMembership ${xymonuser}
161Reboot your system
162Start xymon server:
163    $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.xymon-server.plist
164Open \"http://localhost/xymon/\" in your server's browser
165
166Full install instructions here: http://trac.macports.org/wiki/howto/SetupXymonServer
167
168"
169
170use_parallel_build  no
171
172livecheck.type      regex
173livecheck.url       http://sourceforge.net/projects/${shortname}/files/
174livecheck.regex     ${shortname}-(\[0-9.\]+)\\.tar.gz
175
176variant snmp description {add integrated SNMP support} {
177    configure.env-append    SNMP=1
178}