aboutsummaryrefslogtreecommitdiff
path: root/sysutils/monitorix/Makefile
blob: 1dd042b800656d84fad33107a82424176db7e500 (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
# New ports collection makefile for:	monitorix
# Date created:				15 Aug 2010
# Whom:					Olli Hauer <ohauer@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=	monitorix
PORTVERSION=	2.3.0
PORTREVISION?=	0
CATEGORIES=	sysutils
MASTER_SITES=	http://www.monitorix.org/ \
		http://www.monitorix.org/old_versions/ \
		http://www.bayofrum.net/dist/${PORTNAME}/

MAINTAINER=	crees@FreeBSD.org
COMMENT=	A web based monitoring system

LICENSE=	GPLv2

LIB_DEPENDS=	rrd:${PORTSDIR}/databases/rrdtool
RUN_DEPENDS=	p5-ParallelUA>=0:${PORTSDIR}/www/p5-ParallelUA \
		p5-CGI.pm>=0:${PORTSDIR}/www/p5-CGI.pm \
		p5-libwww>=0:${PORTSDIR}/www/p5-libwww \
		p5-MIME-Lite>=0:${PORTSDIR}/mail/p5-MIME-Lite

USE_PERL5=	5.8+
MAN5=		monitorix.conf.5
MAN8=		monitorix.8
MANCOMPRESSED=	no
NO_BUILD=	yes
USE_RC_SUBR=	${PORTNAME}

CGIDIR?=	www/cgi-bin
CGIPATH?=	cgi-bin
WWW_OWNER?=	${WWWOWN}
WWW_GROUP?=	${WWWGRP}
REPORT_LANG=	ca de en it
WWWROOT=	${WWWDIR:S,/${PORTNAME}$,,}

SUB_FILES=	pkg-message
SUB_LIST=	PERL=${PERL}

PLIST_SUB+=	CGIDIR=${CGIDIR} \
		WWW_OWNER=${WWW_OWNER} \
		WWW_GROUP=${WWW_GROUP}

WWW_FILES=	logo_top.png \
		logo_bot.png \
		monitorixico.png

PORTDOCS=	COPYING \
		Changes \
		README \
		README.FreeBSD \
		README.OpenBSD \
		README.nginx \
		monitorix-alert.sh \
		monitorix-apache.conf

pre-everything::
	@${ECHO_MSG} ""
	@${ECHO_MSG} "You may set following options:"
	@${ECHO_MSG} ""
	@${ECHO_MSG} "DATADIR=${DATADIR}	Where do you put RRD databases?"
	@${ECHO_MSG} "CGIDIR=${CGIDIR}	Where do you put cgi?"
	@${ECHO_MSG} "CGIPATH=${CGIPATH}	What is the relative URL for cgi files?"
	@${ECHO_MSG} "WWWDIR=${WWWDIR}	Where do you put httpd's document root?"
	@${ECHO_MSG} ""

post-patch:
.for f in monitorix.cgi monitorix.conf monitorix reports/send_reports
	@${REINPLACE_CMD} -e "1s|^\(#!\).*|\1${PERL}|" \
		${WRKSRC}/${f}
.endfor
# eth0 doesn't exist in FreeBSD! Also let's set our own paths.
# No iptables, so we'll disable PORT_GRAPH
	@${REINPLACE_CMD} \
		-e 's|\($$BASE_DIR = "\)[^"]*|\1${WWWDIR}/|' \
		-e 's|\($$BASE_LIB = "\)[^"]*|\1${DATADIR}/|' \
		-e 's|\($$BASE_CGI = "\)[^"]*|\1${CGIPATH}/|' \
		-e 's|\($$SECURE_LOG= "\)[^"]*|\1/var/log/auth.log|' \
		-e "s|/var/lib/milter-greylist/db/|/var/milter-greylist/|" \
		-e "s|eth0|lo0|g" \
		-e 's|\("port"[^Y]*\)Y|\1N|' \
			${WRKSRC}/monitorix.conf

do-install:
	@${INSTALL_SCRIPT} ${WRKSRC}/monitorix ${PREFIX}/bin/
	@${MKDIR} ${WWWDIR}/imgs
	@${CHOWN} ${WWW_OWNER}:${WWW_GROUP} ${WWWDIR}/imgs
.for f in ${WWW_FILES}
	@${INSTALL_DATA} ${WRKSRC}/${f} ${WWWDIR}/
.endfor
	@${MKDIR} ${PREFIX}/${CGIDIR}
	@${INSTALL_SCRIPT} ${WRKSRC}/monitorix.cgi ${PREFIX}/${CGIDIR}/
.for m in ${MAN5}
	@${INSTALL_MAN} ${WRKSRC}/man/man5/$m ${MAN5PREFIX}/man/man5/
.endfor
.for m in ${MAN8}
	@${INSTALL_MAN} ${WRKSRC}/man/man8/$m ${MAN8PREFIX}/man/man8/
.endfor
	@${MKDIR} ${WWWDIR}/reports
.for l in ${REPORT_LANG}
	@${INSTALL_DATA} ${WRKSRC}/reports/${l}.html \
		${WWWDIR}/reports/
.endfor
.if !defined(NOPORTDOCS)
	@${MKDIR} ${DOCSDIR}
. for doc in ${PORTDOCS}
	@${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR}
. endfor
.endif

post-install:
	@${MKDIR} ${DATADIR}
	@${MKDIR} ${WWWDIR}/usage
	@${INSTALL_DATA} ${WRKSRC}/monitorix.conf ${PREFIX}/etc/monitorix.conf.sample
	@if [ ! -f ${PREFIX}/etc/monitorix.conf ]; then \
		${CP} -p ${PREFIX}/etc/monitorix.conf.sample \
			${PREFIX}/etc/monitorix.conf ; \
	fi
	@${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>