aboutsummaryrefslogtreecommitdiff
path: root/mail/spamd
diff options
context:
space:
mode:
authorOlli Hauer <ohauer@FreeBSD.org>2011-06-04 21:51:59 +0000
committerOlli Hauer <ohauer@FreeBSD.org>2011-06-04 21:51:59 +0000
commit661cae34a58518f0a1889306f3cf5ca6eac338e0 (patch)
treee843987c8ab06cb5529ce1caf259e740cdfe0ae9 /mail/spamd
parentc5631a034a55f3c27d72cf91fd5e9523cb62f22a (diff)
downloadports-661cae34a58518f0a1889306f3cf5ca6eac338e0.tar.gz
ports-661cae34a58518f0a1889306f3cf5ca6eac338e0.zip
Notes
Diffstat (limited to 'mail/spamd')
-rw-r--r--mail/spamd/Makefile41
-rw-r--r--mail/spamd/distinfo4
-rw-r--r--mail/spamd/files/pkg-deinstall.in23
-rw-r--r--mail/spamd/files/pkg-install.in186
-rw-r--r--mail/spamd/files/pkg-message.in11
-rw-r--r--mail/spamd/pkg-deinstall16
6 files changed, 93 insertions, 188 deletions
diff --git a/mail/spamd/Makefile b/mail/spamd/Makefile
index ef99e197add5..2e8f4e0c132a 100644
--- a/mail/spamd/Makefile
+++ b/mail/spamd/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= spamd
-PORTVERSION= 4.8.0
+PORTVERSION= 4.9.1
CATEGORIES= mail
MASTER_SITES= BERLIOS
MASTER_SITE_SUBDIR=freebsdspamd
@@ -18,31 +18,21 @@ LICENSE= BSD
USE_RC_SUBR?= obspamd obspamlogd
-SPAMDUSER?= _spamd
-SPAMDGROUP?= _spamd
-SPAMDDIR?= /var/empty
-
-SPAMDUID= 132
-SPAMDGID= ${SPAMDUID}
+USERS= _spamd
+GROUPS= _spamd
MAN5= spamd.conf.5
MAN8= spamd.8 spamd-setup.8 spamdb.8 spamlogd.8
PORTDOCS= ipfw-spamd.txt spamdb.txt
-PLIST_DIRS= etc/spamd
-PLIST_FILES= libexec/spamlogd \
+PLIST_DIRSTRY= %%ETCDIR%%
+PLIST_FILES= %%ETCDIR%%/spamd.conf.sample \
+ libexec/spamlogd \
sbin/spamd-setup \
- sbin/spamdb \
- etc/spamd/spamd.conf.sample
-
-CONFIG_DIR= ${PREFIX}/etc/spamd
-SAMPLE_SPAMD_CONF= ${CONFIG_DIR}/spamd.conf.sample
+ sbin/spamdb
-PLIST_SUB= SPAMDDIR=${SPAMDDIR} \
- SPAMDUSER=${SPAMDUSER} \
- SPAMDGROUP=${SPAMDGROUP} \
- SPAMDUID=${SPAMDUID} \
- SPAMDGID=${SPAMDGID}
+PLIST_SUB= SPAMDUSER=${USERS} \
+ SPAMDGROUP=${GROUPS}
# If you are a CPANEL user the this option is for you!
# CPANEL sends periodic a 'kill -TERM spamd' to the SpamAssassin spamd, and
@@ -58,7 +48,6 @@ PLIST_SUB+= SPAMDBIN=obspamd
.endif
SUB_FILES= pkg-install \
- pkg-deinstall \
pkg-message
SUB_LIST= PREFIX=${PREFIX} \
@@ -81,14 +70,9 @@ do-install:
@${INSTALL_MAN} ${WRKSRC}/spamd-setup/spamd-setup.8 ${PREFIX}/man/man8
@${INSTALL_MAN} ${WRKSRC}/spamdb/spamdb.8 ${PREFIX}/man/man8
@${INSTALL_MAN} ${WRKSRC}/spamlogd/spamlogd.8 ${PREFIX}/man/man8
- @if [ ! -d ${CONFIG_DIR} ]; then \
- ${MKDIR} ${CONFIG_DIR}; \
- fi
- @if [ ! -f ${SAMPLE_SPAMD_CONF} ]; then \
- ${ECHO_MSG} "Installing ${SAMPLE_SPAMD_CONF} file."; \
- ${INSTALL_DATA} -p ${WRKSRC}/etc/spamd.conf \
- ${SAMPLE_SPAMD_CONF}; \
- fi
+ @${INSTALL} -d ${ETCDIR}
+ @${INSTALL_DATA} -m 644 ${WRKSRC}/etc/spamd.conf ${ETCDIR}/spamd.conf.sample
+
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
@${INSTALL_DATA} ${WRKSRC}/doc/ipfw-spamd.txt ${DOCSDIR}/
@@ -96,6 +80,7 @@ do-install:
.endif
post-install:
+ @${SH} ${PKGINSTALL} ${DISTNAME} POST-INSTALL
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/mail/spamd/distinfo b/mail/spamd/distinfo
index 48204521a9b4..c3997986cfea 100644
--- a/mail/spamd/distinfo
+++ b/mail/spamd/distinfo
@@ -1,2 +1,2 @@
-SHA256 (spamd-4.8.0.tar.gz) = 47b76b88d954b447b1eeee51ac4b62bec392bead70aa1f01c025773d8486726f
-SIZE (spamd-4.8.0.tar.gz) = 52748
+SHA256 (spamd-4.9.1.tar.gz) = b5d7630b19e897f95d2ad7e80332f86c0c0d508ed65a9190575fe7cbf6aa546d
+SIZE (spamd-4.9.1.tar.gz) = 52884
diff --git a/mail/spamd/files/pkg-deinstall.in b/mail/spamd/files/pkg-deinstall.in
deleted file mode 100644
index 0ca938e71fb8..000000000000
--- a/mail/spamd/files/pkg-deinstall.in
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-#
-
-SPAMDDIR=%%SPAMDDIR%%
-SPAMDUSER=%%SPAMDUSER%%
-SPAMDGROUP=%%SPAMDGROUP%%
-
-if [ "$2" = "POST-DEINSTALL" ]; then
- if /usr/sbin/pw group show "${SPAMDGROUP}" 2>&1 >/dev/null; then
- echo "You should manually remove the \"${SPAMDGROUP}\" group."
- fi
-
- if /usr/sbin/pw user show "${SPAMDUSER}" 2>&1 >/dev/null; then
- echo "You should manually remove the \"${SPAMDUSER}\" user."
- fi
-
- if [ -e "${SPAMDDIR}" ]; then
- if [ "${SPAMDDIR}" != "/var/empty" ]; then
- echo "You should manually remove the \"${SPAMDDIR}\" directory."
- fi
- fi
-fi
diff --git a/mail/spamd/files/pkg-install.in b/mail/spamd/files/pkg-install.in
index 59b99e328370..2c47f98cb50e 100644
--- a/mail/spamd/files/pkg-install.in
+++ b/mail/spamd/files/pkg-install.in
@@ -1,150 +1,72 @@
#!/bin/sh
#
+# ex:ts=4:sw=4:noet
+#-*- mode: makefile; tab-width: 4; -*-
#
+# $FreeBSD$
-SPAMDDIR=%%SPAMDDIR%%
SPAMDUSER=%%SPAMDUSER%%
SPAMDGROUP=%%SPAMDGROUP%%
-SPAMDUID=%%SPAMDUID%%
-SPAMDGID=%%SPAMDGID%%
-
-ask() {
- local question default answer
-
- question=$1
- default=$2
- if [ -z "${PACKAGE_BUILDING}" ]; then
- read -p "${question} [${default}]? " answer
- fi
- if [ "x${answer}" = "x" ]; then
- answer=${default}
- fi
- echo ${answer}
-}
-
-yesno() {
- local default question answer
-
- question=$1
- default=$2
- while :; do
- answer=$(ask "${question}" "${default}")
- case "${answer}" in
- [Yy][Ee][Ss]|[Yy])
- return 0
- ;;
- [Nn][Oo]|[Nn])
- return 1
- ;;
- esac
- echo "Please answer yes or no."
- done
-}
+FILE="/etc/services"
check_db() {
- DB=/var/db/spamd
- if [ -f ${DB} ]; then
- OWN=`ls -l ${DB} | awk '{print $3}'`
- GRP=`ls -l ${DB} | awk '{print $4}'`
- if [ "x${OWN}" != "x${SPAMDUSER}" ]; then
- echo "change ${DB} owner to ${SPAMDUSER}"
- /usr/sbin/chown ${SPAMDUSER} ${DB}
- fi
- if [ "x${GRP}" != "x${SPAMDGROUP}" ]; then
- echo "change ${DB} group to ${SPAMDGROUP}"
- /usr/sbin/chown :${SPAMDGROUP} ${DB}
- fi
- fi
+ DB=/var/db/spamd
+ if [ -f ${DB} ]; then
+ OWN=$(stat -f "%Su" ${DB})
+ GRP=$(stat -f "%Sg" ${DB})
+ if [ "x${OWN}" != "x${SPAMDUSER}" ]; then
+ echo "==> chown ${SPAMDUSER} ${DB} (previous ${OWN})"
+ chown ${SPAMDUSER} ${DB}
+ fi
+ if [ "x${GRP}" != "x${SPAMDGROUP}" ]; then
+ echo "==> chgrp ${SPAMDGROUP} ${DB} (previous ${GRP})"
+ chgrp ${SPAMDGROUP} ${DB}
+ fi
+ fi
}
check_service() {
- local name number type comment
+ local SERVICE PORT PROTO COMMENT
- name=$1
- number=$2
- type=$3
- comment=$4
+ SERVICE=$1
+ PORT=$2
+ PROTO=$3
+ COMMENT=$4
- FILE="/etc/services"
- # check
- OK=no
- HAS_SERVICE=no
- COUNT=1
- for i in `grep $name $FILE `; do
- if [ $COUNT = 1 ] && [ X"$i" = X"$name" ]; then
- HAS_SERVICE=yes
- elif [ $COUNT = 2 ] && [ $HAS_SERVICE = yes ] && \
- [ X"$i" = X"$number/$type" ]; then
- OK=yes
- break
- fi
- COUNT=`expr ${COUNT} + 1`
- done
- # add an entry for SERVICE to /etc/services
- if [ $OK = no ]; then
- echo "This system has no entry for $name in ${FILE}"
- if yesno "Would you like to add it automatically?" y; then
- mv ${FILE} ${FILE}.bak
- (grep -v $name ${FILE}.bak ; \
- echo "$name $number/$type # $comment") \
- >> ${FILE}
- rm ${FILE}.bak
- else
- echo "Please add '$name $number/$type' into ${FILE}, and try again."
- return 1
- fi
- fi
- return 0
+ # check
+ OK=no
+ HAS_SERVICE=no
+ COUNT=1
+ for i in $(grep ^${SERVICE} ${FILE}); do
+ if [ ${COUNT} -eq 1 ] && [ x"${i}" = x"${SERVICE}" ]; then
+ HAS_SERVICE=yes
+ elif [ ${COUNT} -eq 2 ] && [ "${HAS_SERVICE}" = "yes" ] && \
+ [ x"${i}" = x"${PORT}/${PROTO}" ]; then
+ OK=yes
+ break
+ fi
+ COUNT=$(( ${COUNT} + 1 ))
+ done
+ # add an entry for SERVICE to /etc/services
+ if [ "${OK}" = "no" ]; then
+ echo "==> add entry \"${SERVICE} ${PORT}/${PROTO}\""
+ (
+ grep -v -e "^${SERVICE}.*${PORT}/${PROTO}" ${FILE}
+ echo "${SERVICE} ${PORT}/${PROTO} # ${COMMENT}"
+ ) >> ${FILE}.new
+ mv ${FILE}.new ${FILE}
+ fi
}
-
+# always add service entries
if [ "$2" = "PRE-INSTALL" ]; then
- check_dbown=0
- if /usr/sbin/pw group show "${SPAMDGROUP}" 2>&1 >/dev/null; then
- echo "You already have a \"${SPAMDGROUP}\" group, so I will use it."
- check_dbown=1
- else
- echo "You need a \"${SPAMDGROUP}\" group."
- if yesno "Would you like me to create it" "YES"; then
- /usr/sbin/pw groupadd "${SPAMDGROUP}" -g "${SPAMDGID}" -h - || \
- /usr/sbin/pw groupadd "${SPAMDGROUP}" -h - || exit
- echo "Done."
- check_dbown=1
- else
- echo "Please create the \"${SPAMDGROUP}\" group manually and try again."
- exit 1
- fi
- fi
-
- if /usr/sbin/pw user show "${SPAMDUSER}" 2>&1 >/dev/null; then
- echo "You already have a \"${SPAMDUSER}\" user, so I will use it."
- check_dbown=1
- else
- echo "You need a \"${SPAMDUSER}\" user."
- if yesno "Would you like me to create it" "YES"; then
- /usr/sbin/pw useradd "${SPAMDUSER}" -u "${SPAMDUID}" -g "${SPAMDGROUP}" -h - -d "${SPAMDDIR}" \
- -s /sbin/nologin -c "spamd pseudo-user" || \
- /usr/sbin/pw useradd "${SPAMDUSER}" -g "${SPAMDGROUP}" -h - -d "${SPAMDDIR}" \
- -s /sbin/nologin -c "spamd pseudo-user" || exit
- check_dbown=1
- else
- echo "Please create the \"${SPAMDUSER}\" user manually and try again."
- exit 1
- fi
- fi
-
- if [ ${check_dbown} -eq 1 ]; then
- check_db
- fi
-
- if ! check_service spamd 8025 tcp "spamd(8)"; then
- exit 1
- fi
- if ! check_service spamd-cfg 8026 tcp "spamd(8) configuration"; then
- exit 1
- fi
- if ! check_service spamd-sync 8025 udp "spamd(8) synchronisation"; then
- exit 1
- fi
+ echo "Checking ${FILE} for missing service entries"
+ [ ! -f ${FILE} ] && echo "==> cannot find ${FILE} ... => exit" && exit 1
+ check_service spamd 8025 tcp "spamd(8)"
+ check_service spamd-sync 8025 udp "spamd(8) synchronisation"
+ check_service spamd-cfg 8026 tcp "spamd(8) configuration"
+fi
+if [ "$2" = "POST-INSTALL" ]; then
+ check_db
fi
diff --git a/mail/spamd/files/pkg-message.in b/mail/spamd/files/pkg-message.in
index f88beb606857..ced19e8a862f 100644
--- a/mail/spamd/files/pkg-message.in
+++ b/mail/spamd/files/pkg-message.in
@@ -16,6 +16,13 @@ To enable spamd you need:
3) mount fdescfs to /dev/fd with the following line in /etc/fstab
fdescfs /dev/fd fdescfs rw 0 0
+ Note for XEN users:
+ The XEN kernel ships without modules, therefore you have to add
+ the following lines to the kernel config and build a new kernel.
+ options FDESCFS
+ device pf
+ device pflog
+
4) Add following lines to the pf.conf(5)
table <spamd-white> persist
@@ -26,8 +33,6 @@ To enable spamd you need:
FreeBSD only features (not in OpenBSD):
- sync for spamdb (parameter -Y)
- See %%PREFIX%%/%%DOCSDIR%%/ for usage manual.
- - spamdb and spamlogd whiteexp times can be adjusted
- with parameter -W
+ See %%PREFIX%%/%%DOCSDIR%%/ for usage.
**********************************************************************
diff --git a/mail/spamd/pkg-deinstall b/mail/spamd/pkg-deinstall
new file mode 100644
index 000000000000..5de9b4dd3965
--- /dev/null
+++ b/mail/spamd/pkg-deinstall
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# ex:ts=4:sw=4:noet
+#-*- mode: makefile; tab-width: 4; -*-
+#
+# $FreeBSD$
+
+if [ "$2" = "DEINSTALL" ]; then
+ FILE="/etc/services"
+ echo "===> Removing spamd entries from ${FILE}"
+ sed -i '' \
+ -e "/^spamd-sync.*8025/d" \
+ -e "/^spamd-cfg.*8026/d" \
+ -e "/^spamd.*8025/d" \
+ ${FILE}
+fi