summaryrefslogtreecommitdiff
path: root/mail/clamsmtp
diff options
context:
space:
mode:
authormartti <martti@pkgsrc.org>2007-05-30 06:07:08 +0000
committermartti <martti@pkgsrc.org>2007-05-30 06:07:08 +0000
commit4bad4099709ccc6a7fff1585ef662eef39a4d5a6 (patch)
tree77ef7f1865a7cc3070f18a6e36880bf2725bce9d /mail/clamsmtp
parent4d2fc62683e0114415df556a369f0e09d7120176 (diff)
downloadpkgsrc-4bad4099709ccc6a7fff1585ef662eef39a4d5a6.tar.gz
Updated mail/clamsmtp to 1.8nb1
* Make sure clamd is really running before starting clamsmtpd (pkg/36292)
Diffstat (limited to 'mail/clamsmtp')
-rw-r--r--mail/clamsmtp/Makefile3
-rw-r--r--mail/clamsmtp/files/clamsmtpd.sh30
2 files changed, 28 insertions, 5 deletions
diff --git a/mail/clamsmtp/Makefile b/mail/clamsmtp/Makefile
index ba3d6fa6a77..7a0f248f057 100644
--- a/mail/clamsmtp/Makefile
+++ b/mail/clamsmtp/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.29 2007/05/22 12:28:55 martti Exp $
+# $NetBSD: Makefile,v 1.30 2007/05/30 06:07:08 martti Exp $
DISTNAME= clamsmtp-1.8
+PKGREVISION= 1
CATEGORIES= mail
MASTER_SITES= http://memberwebs.com/nielsen/software/clamsmtp/
diff --git a/mail/clamsmtp/files/clamsmtpd.sh b/mail/clamsmtp/files/clamsmtpd.sh
index bd2ddf90ea7..9d46ee2edfb 100644
--- a/mail/clamsmtp/files/clamsmtpd.sh
+++ b/mail/clamsmtp/files/clamsmtpd.sh
@@ -1,6 +1,6 @@
#!@RCD_SCRIPTS_SHELL@
#
-# $NetBSD: clamsmtpd.sh,v 1.5 2005/10/08 08:56:48 xtraeme Exp $
+# $NetBSD: clamsmtpd.sh,v 1.6 2007/05/30 06:07:08 martti Exp $
#
# PROVIDE: clamsmtpd
# REQUIRE: LOGIN clamd
@@ -23,7 +23,7 @@ if [ -f /etc/rc.subr ]; then
fi
name="clamsmtpd"
-rcvar=$name
+rcvar="${name}"
command="@PREFIX@/sbin/${name}"
pidfile="@VARBASE@/run/clamsmtpd.pid"
@@ -39,11 +39,33 @@ if [ -f "${clamav_conffile}" ]; then
/^#/ {next}; /^User[ ]/ {r = $2};
END {print r}' ${clamav_conffile}`}
else
+ : ${socket="/tmp/clamd"}
: ${clamsmtpd_user="@CLAMAV_USER@"}
fi
clamsmtpd_prestart()
{
+ if [ ! -S "${socket}" ]; then
+ # Max wait time is 2 minutes
+ retries=11
+
+ @ECHO@ -n "Waiting for clamd to become ready"
+ while [ ${retries} -gt 0 -a ! -S "${socket}" ]; do
+ @ECHO@ -n "."
+ sleep 10
+ retries=$((retries - 1))
+ done
+ if [ ! -S "${socket}" ]; then
+ @ECHO@ ""
+ @ECHO@ "ERROR: Unable to start clamsmtpd as clamd is not running!"
+ exit 1
+ fi
+
+ # Wait another 10 seconds so that clamd is really ready
+ @ECHO@ -n "."
+ sleep 10
+ @ECHO@ ""
+ fi
@TOUCH@ ${pidfile}
@CHOWN@ ${clamsmtpd_user} ${pidfile}
}
@@ -52,11 +74,11 @@ clamsmtpd_start()
{
@ECHO@ "Starting ${name}."
doit="${command} ${clamsmtpd_flags} -p ${pidfile}"
- @SU@ -m ${clamsmtpd_user} -c "$doit"
+ @SU@ -m ${clamsmtpd_user} -c "${doit}"
}
if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
- load_rc_config $name
+ load_rc_config ${name}
run_rc_command "$1"
else
if [ -f /etc/rc.conf ]; then