aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mailscanner-mrtg/Makefile
blob: fad8b7c23341525bc0bf231a85f9f23507627186 (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
# New ports collection makefile for:    mailscanner-mrtg
# Date created:     2004-01-27
# Whom:         services-root <root@services.intern.seceidos.de>
#
# $FreeBSD$
#

PORTNAME=   mailscanner-mrtg
PORTVERSION=    0.10.00
CATEGORIES= mail
MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= mailscannermrtg
DISTNAME=   mailscanner-mrtg-${PORTVERSION}

MAINTAINER= j.koopmann@seceidos.de
COMMENT=    Allows mrtg to monitor many aspects of your MailScanner machine

RUN_DEPENDS=    ${LOCALBASE}/bin/mrtg:${PORTSDIR}/net-mgmt/mrtg \
        ${LOCALBASE}/lib/MailScanner/MailScanner.pm:${PORTSDIR}/mail/mailscanner

USE_PERL5=  yes
USE_APACHE= yes

PKGMESSAGE= ${WRKDIR}/pkg-message

WWWBASE=    ${PREFIX}/www

MAN8=       mailscanner-mrtg.8

.include <bsd.port.pre.mk>

WWWFILES=   mailscanner-mrtg.conf \
        mailscanner-mrtg.cfg
ETCFILES=   ${WWWFILES}

do-build:
.for FILE in ${WWWFILES}
    ${PERL} -pi -e \
    's,/var/www/html,${WWWBASE},g; \
    s,/usr/sbin/mailscanner-mrtg,${PREFIX}/sbin/mailscanner-mrtg,g;' \
    ${WRKSRC}/${FILE}
.endfor

    ${PERL} -pi -e \
    's,/usr/bin/snmpwalk,${LOCALBASE}/bin/snmpwalk,g; \
    s,/etc/rc.d/init.d/MailScanner,${LOCALBASE}/etc/rc.d/mailscanner.sh,g;' \
    ${WRKSRC}/mailscanner-mrtg.conf

    ${PERL} -pi -e \
    's,/usr/lib/MailScanner-MRTG,${PREFIX}/lib/MailScanner-MRTG,g; \
    s,/etc/MailScanner/mailscanner-mrtg.conf,${PREFIX}/etc/mailscanner-mrtg/mailscanner-mrtg.conf,g;' \
    ${WRKSRC}/mailscanner-mrtg

do-install:
    #
    # Step 1: Install lib
    #
    ${MKDIR} ${PREFIX}/lib/MailScanner-MRTG/MSMRTG
    ${CHMOD} -R ${BINMODE} ${PREFIX}/lib/MailScanner-MRTG/MSMRTG
    cd ${WRKSRC}/lib/MSMRTG && ${FIND} * -name "*.pm" -exec \
        ${INSTALL_SCRIPT} {} ${PREFIX}/lib/MailScanner-MRTG/MSMRTG \;

    #
    # Step 2: Install etc files
    #
    ${MKDIR} ${PREFIX}/etc/mailscanner-mrtg
    ${CHMOD} ${BINMODE} ${PREFIX}/etc/mailscanner-mrtg
.for FILE in ${ETCFILES}
    ${INSTALL_DATA} ${WRKSRC}/${FILE} ${PREFIX}/etc/mailscanner-mrtg/${FILE}.sample
.endfor

    #
    # Step 3: Install binaries
    #
    ${MKDIR} ${PREFIX}/sbin
    ${INSTALL_SCRIPT} ${WRKSRC}/mailscanner-mrtg ${PREFIX}/sbin

    #
    # Step 4: Install Documentation & Manpages
    #
    ${INSTALL_MAN} ${FILESDIR}/${MAN8} ${MAN8PREFIX}/man/man8
.if !defined(NOPORTDOCS)
    ${MKDIR} ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/docs/* ${DOCSDIR}
.endif

    #
    # Step 5: Install Web Environment
    #
    ${MKDIR} ${WWWBASE}/mailscanner-mrtg
    ${INSTALL_DATA} ${WRKSRC}/web/* ${WWWBASE}/mailscanner-mrtg

    #
    # Step 6: Show further instructions
    #
    @${PERL} -pi -e \
    's,%%PREFIX%%,${PREFIX},g; \
    s,%%LOCALBASE%%,${LOCALBASE},g; \
    s,%%WWWBASE%%,${WWWBASE},g; \
    s,%%PORTSDIR%%,${PORTSDIR},g;' \
    < pkg-message > ${PKGMESSAGE}

    @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>