summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsalo <salo@pkgsrc.org>2007-05-31 14:22:21 +0000
committersalo <salo@pkgsrc.org>2007-05-31 14:22:21 +0000
commitc9f1b7e4779b9cb2c414829aba46faec1b9b4a3c (patch)
tree34b02e02b1ec99bdf9536b4727f4ff59bcc8dd4e
parentcf6a0d1e3037a46e60e9d70e0a4f1b91c3f1e0c0 (diff)
downloadpkgsrc-c9f1b7e4779b9cb2c414829aba46faec1b9b4a3c.tar.gz
Pullup ticket 2103 - requested by martti
rc.d script fix for clamsmtp Revisions pulled up: - pkgsrc/mail/clamsmtp/Makefile 1.30 - pkgsrc/mail/clamsmtp/files/clamsmtpd.sh 1.6 Module Name: pkgsrc Committed By: martti Date: Wed May 30 06:07:08 UTC 2007 Modified Files: pkgsrc/mail/clamsmtp: Makefile pkgsrc/mail/clamsmtp/files: clamsmtpd.sh Log Message: Updated mail/clamsmtp to 1.8nb1 * Make sure clamd is really running before starting clamsmtpd (pkg/36292)
-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 aa7092a38d5..6df8be42493 100644
--- a/mail/clamsmtp/Makefile
+++ b/mail/clamsmtp/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.26 2006/10/27 17:37:18 xtraeme Exp $
+# $NetBSD: Makefile,v 1.26.4.1 2007/05/31 14:22:21 salo 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..31fa98b3ea2 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.5.12.1 2007/05/31 14:22:21 salo 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