aboutsummaryrefslogtreecommitdiffstats
path: root/security/drweb-sendmail/Makefile
blob: 8ea770e67cb264e6908c0a4bc76ee3b6d232c801 (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
# New ports collection makefile for:   drweb_sendmail
# Date created:        14 August 2001
# Whom:                Anton Voronin <anton@chelcom.ru>
#
# $FreeBSD$
#

PORTNAME=   drweb_sendmail
PORTVERSION=    4.31
CATEGORIES= security mail
MASTER_SITES=   ftp://ftp.drweb.ru/pub/unix/ \
        ftp://ftp.drweb.ru/pub/unix/archive/ \
        ftp://ftp.drweb.ru/pub/unix/archive/drweb-clients-${PORTVERSION}/
DISTNAME=   drweb-clients-${PORTVERSION}-sources

MAINTAINER= ports@FreeBSD.org
COMMENT=    Sendmail message filter for virus processing through DrWeb daemon

BUILD_DEPENDS=  ${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash2
RUN_DEPENDS=    ${LOCALBASE}/etc/rc.d/00drwebd.sh:${PORTSDIR}/security/drweb

WRKSRC=     ${WRKDIR}/${DISTNAME}

INST_PREFIX=    ${PREFIX}/${PORTNAME}
DOC_DIR=    ${PREFIX}/share/doc/drweb-sendmail

.if !exists( /usr/include/libmilter/mfapi.h )
BUILD_DEPENDS+= ${LOCALBASE}/include/libmilter/mfapi.h:${PORTSDIR}/mail/sendmail
.endif

.if !defined(WITH_DRWEBSMF_HOSTNAME)
.if defined(BATCH)
WITH_DRWEBSMF_HOSTNAME= your.domain.name
.else
WITH_DRWEBSMF_HOSTNAME!=hostname
.endif
.endif

.if defined(BATCH)
RANDOM_NUMBER=!!!___EDIT_THIS___!!!
.else
RANDOM_NUMBER!=dd if=/dev/random count=1 2> /dev/null | /sbin/md5
.endif

LANGS=en en-ru en-pl
CONFS=drweb_smf users viruses addresses
TMPLS=error-admin error-sender archive-admin archive-sender skip-sender \
      virus-admin virus-rcpts virus-sender rule-admin

post-patch:
    ${SED} "s#%PREFIX%#${PREFIX}#g" < ${FILESDIR}/drweb-sendmail.sh \
        > ${WRKSRC}/drweb-sendmail.sh
    cd ${WRKSRC} && \
    ${SED} "s#%PREFIX%#${PREFIX}#g" < dw_options.c > ndwo.c && \
        mv ndwo.c dw_options.c
    cd ${WRKSRC}/doc/sendmail && \
    ${SED} "s#%LOCALBASE%#${LOCALBASE}#g" < configure > nconf && \
        mv nconf configure && chmod a+rx configure
    cd ${WRKSRC}/etc && \
    ${SED} "s#%PREFIX%#${PREFIX}#g;\
        s#%HOSTNAME%#${WITH_DRWEBSMF_HOSTNAME}#g;\
        s#!!!___EDIT_THIS___!!!#${RANDOM_NUMBER}#" \
        < drweb_smf.conf > ndrwsmf.conf && \
        mv ndrwsmf.conf drweb_smf.conf

post-configure:
    cd ${WRKSRC} && { \
        ${ECHO_CMD} ${PORTVERSION}; \
        ${ECHO_CMD} y; \
        ${ECHO_CMD} n; \
        ${ECHO_CMD} y; \
        ${ECHO_CMD} n; \
        ${ECHO_CMD} n; \
        ${ECHO_CMD} n; \
        ${ECHO_CMD} n; \
        ${ECHO_CMD} n; \
        ${ECHO_CMD} n; \
        ${ECHO_CMD} y; \
        ${ECHO_CMD} ${CFLAGS} ; \
        ${ECHO_CMD} y; \
    } | ./configure

do-install:
    ${MKDIR} ${DOC_DIR}
.for LANG in ${LANGS}
    ${MKDIR} ${PREFIX}/etc/drweb/templates/${LANG}/sendmail
.endfor
.for CONF in ${CONFS}
    ${INSTALL_DATA} -m 600 ${WRKSRC}/etc/${CONF}.conf \
        ${PREFIX}/etc/drweb/${CONF}.conf-dist
    if [ ! -f ${PREFIX}/etc/drweb/${CONF}.conf ]; then \
        ${INSTALL_DATA} -m 600 ${WRKSRC}/etc/${CONF}.conf \
        ${PREFIX}/etc/drweb/${CONF}.conf; \
    fi
.endfor
.for LANG in ${LANGS}
.for TMPL in ${TMPLS}
    cd ${WRKSRC}/etc/templates/${LANG}/sendmail && \
        tr -d '\r' < ${TMPL}.msg > \
        ${PREFIX}/etc/drweb/templates/${LANG}/sendmail/${TMPL}.msg-dist
    if [ ! -f ${PREFIX}/etc/drweb/templates/${LANG}/sendmail/${TMPL}.msg ]; then \
        cd ${PREFIX}/etc/drweb/templates/${LANG}/sendmail && \
        ${CP} ${TMPL}.msg-dist ${TMPL}.msg; \
    fi
.endfor
.endfor
    ${INSTALL_PROGRAM} ${WRKSRC}/drweb-smf ${PREFIX}/sbin/
    ${INSTALL_PROGRAM} ${WRKSRC}/drwebdc ${PREFIX}/sbin/
    cd ${WRKSRC}/doc/sendmail && { \
        ${ECHO_CMD} ; \
        ${ECHO_CMD} "${PREFIX}/drweb"; \
        ${ECHO_CMD} "${PREFIX}/drweb/drweb32.ini"; \
        ${ECHO_CMD} "${PREFIX}/sbin"; \
        ${ECHO_CMD} "${PREFIX}/etc/drweb/drweb_smf.conf"; \
        ${ECHO_CMD} ; \
        ${ECHO_CMD} ; \
        ${ECHO_CMD} t; \
        ${ECHO_CMD} ; \
        ${ECHO_CMD} ; \
    } | ./configure
    cd ${WRKSRC}/doc/sendmail && \
        ${INSTALL_DATA} readme* *.txt sendmail.??.addon \
        ${DOC_DIR}
    ${INSTALL_DATA} ${WRKSRC}/drweb-sendmail.sh \
        ${PREFIX}/etc/rc.d/drweb-sendmail.sh-dist
    if [ ! -f ${PREFIX}/etc/rc.d/drweb-sendmail.sh ]; then \
        ${INSTALL_SCRIPT} ${WRKSRC}/drweb-sendmail.sh \
            ${PREFIX}/etc/rc.d/; \
    fi

post-install:
    @echo
    @echo "Read documentation about additional sendmail tuning needed"
    @echo "in ${DOC_DIR}."
    @echo

.include <bsd.port.mk>