aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/amavisd/Makefile13
-rw-r--r--security/amavisd/files/amavisd-milter.sh31
-rw-r--r--security/amavisd/files/amavisd.sh12
-rw-r--r--security/amavisd/pkg-plist.milter18
4 files changed, 69 insertions, 5 deletions
diff --git a/security/amavisd/Makefile b/security/amavisd/Makefile
index 949456bd242..cb47f7c6af7 100644
--- a/security/amavisd/Makefile
+++ b/security/amavisd/Makefile
@@ -7,7 +7,7 @@
PORTNAME= amavisd
PORTVERSION= 20020300
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= security
MASTER_SITES= http://www.amavis.org/dist/perl/
DISTNAME= ${PORTNAME}-snapshot-${PORTVERSION}
@@ -39,6 +39,8 @@ AMAVISGROUP?= vscan
CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc --with-amavisuser=${AMAVISUSER}:${AMAVISGROUP}
+STARTSCRIPT= amavisd.sh
+
.if defined(WITH_POSTFIX)
CONFIGURE_ARGS+= --enable-postfix
MTA?= postfix
@@ -47,19 +49,24 @@ RUN_DEPENDS+= ${LOCALBASE}/libexec/postfix/smtpd:${PORTSDIR}/mail/postfix
CONFIGURE_ARGS+= --enable-postfix
MTA?= postfix
RUN_DEPENDS+= ${LOCALBASE}/libexec/postfix/smtpd:${PORTSDIR}/mail/postfix-current
+.elif defined(WITH_MILTER)
+CONFIGURE_ARGS+= --enable-milter
+MTA?= milter
+PLIST= ${PKGDIR}/pkg-plist.milter
+STARTSCRIPT= amavisd-milter.sh
.else
CONFIGURE_ARGS+= --enable-sendmail
MTA?= sendmail
.endif
post-patch:
- @${SED} 's,%%AMAVISUSER%%,${AMAVISUSER},g' ${FILESDIR}/amavisd.sh > ${WRKSRC}/amavisd.sh
+ @${SED} 's,%%AMAVISUSER%%,${AMAVISUSER},g' ${FILESDIR}/${STARTSCRIPT} > ${WRKSRC}/${STARTSCRIPT}
pre-install:
@${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${AMAVISUSER} ${AMAVISGROUP}
post-install:
- ${INSTALL_SCRIPT} ${WRKSRC}/amavisd.sh ${PREFIX}/etc/rc.d
+ ${INSTALL_SCRIPT} ${WRKSRC}/${STARTSCRIPT} ${PREFIX}/etc/rc.d
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for FILE in FAQ INSTALL README README.exim README.milter README.postfix README.qmail README.scanners README.sendmail doc/amavis.html doc/amavis.m4 doc/amavis.png doc/amavis.txt
diff --git a/security/amavisd/files/amavisd-milter.sh b/security/amavisd/files/amavisd-milter.sh
new file mode 100644
index 00000000000..8ab574f4bac
--- /dev/null
+++ b/security/amavisd/files/amavisd-milter.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
+ echo "$0: Cannot determine the PREFIX" >&2
+ exit 1
+fi
+
+case "$1" in
+start)
+ ( [ -x ${PREFIX}/sbin/amavisd ] && [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1
+ AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }')
+ AMAVIS_MILTER=$(/bin/ps -xU %%AMAVISUSER%% | grep amavis-milter | awk '{ print $1 }')
+ ( /bin/test "$AMAVISD" || /bin/test "$AMAVIS_MILTER" ) && \
+ su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD $AMAVIS_MILTER" > /dev/null
+ rm -rf /var/amavis/amavis*.sock
+ su - %%AMAVISUSER%% -c "${PREFIX}/sbin/amavis-milter -D -p /var/amavis/amavis-milter.sock" > /dev/null
+ su - %%AMAVISUSER%% -c ${PREFIX}/sbin/amavisd > /dev/null 2>&1 && echo -n ' amavisd-milter'
+ ;;
+stop)
+ ( [ -x ${PREFIX}/sbin/amavisd ] && [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1
+ AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }')
+ AMAVIS_MILTER=$(/bin/ps -xU %%AMAVISUSER%% | grep amavis-milter | awk '{ print $1 }')
+ ( /bin/test "$AMAVISD" || /bin/test "$AMAVIS_MILTER" ) && \
+ su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD $AMAVIS_MILTER" > /dev/null && echo -n ' amavisd-milter'
+ ;;
+*)
+ echo "Usage: `basename $0` {start|stop}" >&2
+ ;;
+esac
+
+exit 0
diff --git a/security/amavisd/files/amavisd.sh b/security/amavisd/files/amavisd.sh
index e09150d0b72..823b03e4a90 100644
--- a/security/amavisd/files/amavisd.sh
+++ b/security/amavisd/files/amavisd.sh
@@ -7,10 +7,18 @@ fi
case "$1" in
start)
- [ -x ${PREFIX}/sbin/amavisd ] && su - %%AMAVISUSER%% -c ${PREFIX}/sbin/amavisd > /dev/null 2>&1 && echo -n ' amavisd'
+ ( [ -x ${PREFIX}/sbin/amavisd ] && [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1
+ AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }')
+ ( /bin/test "$AMAVISD" ) && \
+ su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD" > /dev/null
+ rm -rf /var/amavis/amavis*.sock
+ su - %%AMAVISUSER%% -c ${PREFIX}/sbin/amavisd > /dev/null 2>&1 && echo -n ' amavisd'
;;
stop)
- echo -n ' amavisd'
+ ( [ -x ${PREFIX}/sbin/amavisd ] && [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1
+ AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }')
+ ( /bin/test "$AMAVISD") && \
+ su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD" > /dev/null && echo -n ' amavisd'
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
diff --git a/security/amavisd/pkg-plist.milter b/security/amavisd/pkg-plist.milter
new file mode 100644
index 00000000000..43247c6abb1
--- /dev/null
+++ b/security/amavisd/pkg-plist.milter
@@ -0,0 +1,18 @@
+%%PORTDOCS%%share/doc/amavisd/FAQ
+%%PORTDOCS%%share/doc/amavisd/INSTALL
+%%PORTDOCS%%share/doc/amavisd/README
+%%PORTDOCS%%share/doc/amavisd/README.exim
+%%PORTDOCS%%share/doc/amavisd/README.milter
+%%PORTDOCS%%share/doc/amavisd/README.postfix
+%%PORTDOCS%%share/doc/amavisd/README.qmail
+%%PORTDOCS%%share/doc/amavisd/README.scanners
+%%PORTDOCS%%share/doc/amavisd/README.sendmail
+%%PORTDOCS%%share/doc/amavisd/amavis.html
+%%PORTDOCS%%share/doc/amavisd/amavis.m4
+%%PORTDOCS%%share/doc/amavisd/amavis.png
+%%PORTDOCS%%share/doc/amavisd/amavis.txt
+%%PORTDOCS%%@dirrm share/doc/amavisd
+etc/amavisd.conf
+etc/rc.d/amavisd-milter.sh
+sbin/amavis-milter
+sbin/amavisd