diff options
-rw-r--r-- | mail/clamsmtp/Makefile | 3 | ||||
-rw-r--r-- | mail/clamsmtp/files/clamsmtpd.sh | 30 |
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 |