aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt/smokeping/Makefile
blob: 7fce73ce5f709554f613a029d3a888e5ee2fdc88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# New ports collection makefile for:    SmokePing
# Date created:             Tue Feb 12 22:17:40 CET 2002
# Whom:                                 Lars Thegler <lars@thegler.dk>
#
# $FreeBSD$
#

PORTNAME=   smokeping
PORTVERSION=    2.4.2
PORTREVISION=   2
CATEGORIES= net-mgmt www
MASTER_SITES=   http://oss.oetiker.ch/smokeping/pub/ \
        http://smokeping.cs.pu.edu.tw/pub/

MAINTAINER= lth@FreeBSD.org
COMMENT=    Latency logging and graphing system

RUN_DEPENDS=    rrdtool:${PORTSDIR}/databases/rrdtool \
        p5-CGI-Session>0:${PORTSDIR}/www/p5-CGI-Session \
        p5-CGI-SpeedyCGI>0:${PORTSDIR}/www/p5-CGI-SpeedyCGI \
        p5-Digest-HMAC>0:${PORTSDIR}/security/p5-Digest-HMAC \
        p5-Net>0:${PORTSDIR}/net/p5-Net \
        p5-SNMP_Session>0:${PORTSDIR}/net-mgmt/p5-SNMP_Session \
        p5-libwww>0:${PORTSDIR}/www/p5-libwww

NO_BUILD=   yes
USE_PERL5=  yes

OPTIONS=    FPING "Support for fping probes" on
OPTIONS+=   ECHOPING "Support for EchoPing probes" off
OPTIONS+=   CURL "Support for Curl probes" off
OPTIONS+=   LDAP "Support for LDAP probes" off
OPTIONS+=   LDAPSSL "Support for SSL-enabled LDAP probes" off
OPTIONS+=   RADIUS "Support for Radius probes" off
OPTIONS+=   TELNET "Support for TelnetIOSPing probes" off
OPTIONS+=   DNS "Support for AnotherDNS probes" off

.include <bsd.port.pre.mk>

.ifdef(WITH_FPING)
RUN_DEPENDS+=   ${LOCALBASE}/sbin/fping:${PORTSDIR}/net/fping
.endif

.ifdef(WITH_ECHOPING)
RUN_DEPENDS+=   ${LOCALBASE}/bin/echoping:${PORTSDIR}/net/echoping
.endif

.ifdef(WITH_CURL)
RUN_DEPENDS+=   ${LOCALBASE}/bin/curl:${PORTSDIR}/ftp/curl
.endif

.if defined(WITH_LDAP) || defined(WITH_LDAPSSL)
RUN_DEPENDS+=   ${SITE_PERL}/Net/LDAP.pm:${PORTSDIR}/net/p5-perl-ldap
.endif

.ifdef(WITH_RADIUS)
RUN_DEPENDS+=   ${SITE_PERL}/Authen/Radius.pm:${PORTSDIR}/security/p5-Authen-Radius
.endif

.ifdef(WITH_LDAPSSL)
RUN_DEPENDS+=   ${SITE_PERL}/IO/Socket/SSL.pm:${PORTSDIR}/security/p5-IO-Socket-SSL
.endif

.ifdef(WITH_TELNET)
RUN_DEPENDS+=   ${SITE_PERL}/Net/Telnet.pm:${PORTSDIR}/net/p5-Net-Telnet
.endif

.ifdef(WITH_DNS)
RUN_DEPENDS+=   ${SITE_PERL}/${PERL_ARCH}/Net/DNS.pm:${PORTSDIR}/dns/p5-Net-DNS
.endif

USE_RC_SUBR=    smokeping

MAN1=       smokeping.1 \
        smokeping.cgi.1 \
        tSmoke.1
MAN3=       Config::Grammar.3 \
        Smokeping.3 \
        Smokeping::Examples.3 \
        Smokeping::RRDtools.3 \
        Smokeping::matchers::Avgratio.3 \
        Smokeping::matchers::Median.3 \
        Smokeping::matchers::base.3 \
        Smokeping::probes::AnotherDNS.3 \
        Smokeping::probes::AnotherSSH.3 \
        Smokeping::probes::CiscoRTTMonDNS.3 \
        Smokeping::probes::CiscoRTTMonEchoICMP.3 \
        Smokeping::probes::CiscoRTTMonTcpConnect.3 \
        Smokeping::probes::Curl.3 \
        Smokeping::probes::DNS.3 \
        Smokeping::probes::EchoPing.3 \
        Smokeping::probes::EchoPingChargen.3 \
        Smokeping::probes::EchoPingDiscard.3 \
        Smokeping::probes::EchoPingHttp.3 \
        Smokeping::probes::EchoPingHttps.3 \
        Smokeping::probes::EchoPingIcp.3 \
        Smokeping::probes::EchoPingSmtp.3 \
        Smokeping::probes::FPing.3 \
        Smokeping::probes::FPing6.3 \
        Smokeping::probes::IOSPing.3 \
        Smokeping::probes::LDAP.3 \
        Smokeping::probes::Radius.3 \
        Smokeping::probes::RemoteFPing.3 \
        Smokeping::probes::SSH.3 \
        Smokeping::probes::TelnetIOSPing.3 \
        Smokeping::probes::base.3 \
        Smokeping::probes::basefork.3 \
        Smokeping::probes::basevars.3 \
        Smokeping::probes::passwordchecker.3 \
        Smokeping::probes::skel.3
MAN5=       smokeping_config.5
MAN7=       smokeping_examples.7 \
        smokeping_extend.7 \
        smokeping_install.7 \
        smokeping_upgrade.7

PKGMESSAGE= ${WRKDIR}/pkg-message
PKGINSTALL= ${WRKDIR}/pkg-install
PKGDEINSTALL=   ${WRKDIR}/pkg-deinstall

USER=       smokeping
SMOKEPING_UID=  117
GROUP=      smokeping
SMOKEPING_GID=  117

SUB_LIST+=  USER=${USER} UID=${SMOKEPING_UID} \
        GROUP=${GROUP} GID=${SMOKEPING_GID} \
        PERL=${PERL} PREFIX=${PREFIX}

DOC1=       CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO
DOC2=       Config/Grammar \
        Smokeping \
        Smokeping/Examples \
        Smokeping/RRDtools \
        Smokeping/matchers/Avgratio \
        Smokeping/matchers/Median \
        Smokeping/matchers/base \
        Smokeping/probes/AnotherDNS \
        Smokeping/probes/AnotherSSH \
        Smokeping/probes/CiscoRTTMonDNS \
        Smokeping/probes/CiscoRTTMonEchoICMP \
        Smokeping/probes/CiscoRTTMonTcpConnect \
        Smokeping/probes/Curl \
        Smokeping/probes/DNS \
        Smokeping/probes/EchoPing \
        Smokeping/probes/EchoPingChargen \
        Smokeping/probes/EchoPingDiscard \
        Smokeping/probes/EchoPingHttp \
        Smokeping/probes/EchoPingHttps \
        Smokeping/probes/EchoPingIcp \
        Smokeping/probes/EchoPingSmtp \
        Smokeping/probes/FPing \
        Smokeping/probes/FPing6 \
        Smokeping/probes/IOSPing \
        Smokeping/probes/LDAP \
        Smokeping/probes/Radius \
        Smokeping/probes/RemoteFPing \
        Smokeping/probes/SSH \
        Smokeping/probes/TelnetIOSPing \
        Smokeping/probes/base \
        Smokeping/probes/basefork \
        Smokeping/probes/basevars \
        Smokeping/probes/passwordchecker \
        Smokeping/probes/skel \
        smokeping.cgi \
        smokeping \
        smokeping_config \
        smokeping_examples \
        smokeping_extend \
        smokeping_install \
        smokeping_upgrade \
        tSmoke

EXAMPLES=   config.echoping \
        config.fping-instances \
        config.multiple-probes \
        config.simple \
        config.targetvars-with-Curl \
        config.template

ETC1=       basepage.html config smokemail tmail

# Things that shouldn't have been in the tarball in the first place
post-extract:
    ${RM} ${WRKSRC}/lib/BER.pm
    ${RM} ${WRKSRC}/lib/SNMP_*.pm
    ${RM} -rf ${WRKSRC}/lib/Digest
    ${RM} -rf ${WRKSRC}/lib/CGI

pre-patch:
    ${REINPLACE_CMD} -e s!/usr/bin/!%%PREFIX%%/bin/! \
        ${WRKSRC}/lib/Smokeping.pm \
        ${WRKSRC}/lib/Smokeping/Examples.pm \
        ${WRKSRC}/lib/Smokeping/probes/Curl.pm \
        ${WRKSRC}/lib/Smokeping/probes/IOSPing.pm \
        ${WRKSRC}/lib/Smokeping/probes/DNS.pm \
        ${WRKSRC}/lib/Smokeping/probes/RemoteFPing.pm \
        ${WRKSRC}/lib/Smokeping/probes/SSH.pm \
        ${WRKSRC}/lib/Smokeping/probes/FPing6.pm \
        ${WRKSRC}/lib/Smokeping/probes/EchoPing.pm \
        ${WRKSRC}/lib/Smokeping/probes/FPing.pm
    ${REINPLACE_CMD} -e s!/usr/share/smokeping/etc/!%%PREFIX%%/etc/smokeping/! \
        ${WRKSRC}/lib/Smokeping/probes/passwordchecker.pm

post-patch:
    ${FIND} ${WRKSRC} -name \*.orig -delete

pre-configure:
    ${REINPLACE_CMD} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
        ${WRKSRC}/lib/Smokeping.pm \
        ${WRKSRC}/lib/Smokeping/Examples.pm \
        ${WRKSRC}/bin/smokeping.dist \
        ${WRKSRC}/bin/tSmoke.dist \
        ${WRKSRC}/htdocs/smokeping.cgi.dist \
        ${WRKSRC}/htdocs/tr.cgi.dist \
        ${WRKSRC}/etc/config.dist \
        ${WRKSRC}/lib/Smokeping/probes/*.pm
    ${FIND} ${WRKSRC} -name \*.bak -delete
    ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
        ${PKGDIR}/pkg-message > ${PKGMESSAGE}
    ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
        ${PKGDIR}/pkg-install > ${PKGINSTALL}
    ${SED} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
        ${PKGDIR}/pkg-deinstall > ${PKGDEINSTALL}
    ${MV} ${WRKSRC}/bin/smokeping.dist ${WRKSRC}/bin/smokeping
    ${MV} ${WRKSRC}/bin/tSmoke.dist ${WRKSRC}/bin/tSmoke
    ${MV} ${WRKSRC}/htdocs/smokeping.cgi.dist ${WRKSRC}/htdocs/smokeping.cgi
    ${MV} ${WRKSRC}/htdocs/tr.cgi.dist ${WRKSRC}/htdocs/tr.cgi

pre-su-install:
    PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL

do-install:
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/smokeping ${PREFIX}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/tSmoke ${PREFIX}/bin
    (cd ${WRKSRC}/doc && ${INSTALL_MAN} ${MAN1} ${PREFIX}/man/man1)
    (cd ${WRKSRC}/doc && ${INSTALL_MAN} ${MAN5} ${PREFIX}/man/man5)
    (cd ${WRKSRC}/doc && ${INSTALL_MAN} ${MAN7} ${PREFIX}/man/man7)
.for FILE in ${MAN3}
    ${INSTALL_MAN} `${FIND} ${WRKSRC}/doc -name ${FILE}` ${PREFIX}/man/man3
.endfor
.if !defined(NOPORTDOCS)
    ${MKDIR} ${DOCSDIR}
    ${MKDIR} ${DOCSDIR}/Config
    ${MKDIR} ${DOCSDIR}/Smokeping/matchers
    ${MKDIR} ${DOCSDIR}/Smokeping/probes
    (cd ${WRKSRC} && ${INSTALL_DATA} ${DOC1} ${DOCSDIR})
.for FILE in ${DOC2}
    ${INSTALL_DATA} ${WRKSRC}/doc/${FILE}.html ${DOCSDIR}/${FILE}.html
    ${INSTALL_DATA} ${WRKSRC}/doc/${FILE}.txt  ${DOCSDIR}/${FILE}.txt
.endfor
.endif
.if !defined(NOPORTEXAMPLES)
    ${MKDIR} ${EXAMPLESDIR}
    (cd ${WRKSRC}/doc/examples && ${INSTALL_DATA} ${EXAMPLES} ${EXAMPLESDIR})
.endif
    ${MKDIR} ${ETCDIR}
.for FILE in ${ETC1}
    ${INSTALL_DATA} ${WRKSRC}/etc/${FILE}.dist ${ETCDIR}
    if [ ! -f ${ETCDIR}/${FILE} ]; then \
        ${INSTALL_DATA} ${WRKSRC}/etc/${FILE}.dist ${ETCDIR}/${FILE} ; \
    fi
.endfor
    ${MKDIR} ${PREFIX}/smokeping/htdocs
    ${MKDIR} ${PREFIX}/smokeping/htdocs/img
    ${CP} -R ${WRKSRC}/htdocs ${PREFIX}/smokeping/
    ${CHOWN} -R ${WWWOWN}:${WWWGRP} ${PREFIX}/smokeping/htdocs
    ${CP} -R ${WRKSRC}/lib ${PREFIX}/smokeping/
    ${MKDIR} ${PREFIX}/var/smokeping
    ${CHOWN} -R ${USER}:${GROUP} ${PREFIX}/var/smokeping

post-install:
    PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.if !defined(BATCH)
    ${CAT} ${PKGMESSAGE}
.endif

post-deinstall:
    PKG_PREFIX=${PREFIX} ${SH} ${PKGDEINSTALL} ${PKGNAME} POST-DEINSTALL

.include <bsd.port.post.mk>