pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail/clamsmtp Updated mail/clamsmtp to 1.8nb1



details:   https://anonhg.NetBSD.org/pkgsrc/rev/26e0cd30221b
branches:  trunk
changeset: 529286:26e0cd30221b
user:      martti <martti%pkgsrc.org@localhost>
date:      Wed May 30 06:07:08 2007 +0000

description:
Updated mail/clamsmtp to 1.8nb1

* Make sure clamd is really running before starting clamsmtpd (pkg/36292)

diffstat:

 mail/clamsmtp/Makefile           |   3 ++-
 mail/clamsmtp/files/clamsmtpd.sh |  30 ++++++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 5 deletions(-)

diffs (80 lines):

diff -r 5810355ae02c -r 26e0cd30221b mail/clamsmtp/Makefile
--- a/mail/clamsmtp/Makefile    Wed May 30 05:58:20 2007 +0000
+++ b/mail/clamsmtp/Makefile    Wed May 30 06:07:08 2007 +0000
@@ -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 -r 5810355ae02c -r 26e0cd30221b mail/clamsmtp/files/clamsmtpd.sh
--- a/mail/clamsmtp/files/clamsmtpd.sh  Wed May 30 05:58:20 2007 +0000
+++ b/mail/clamsmtp/files/clamsmtpd.sh  Wed May 30 06:07:08 2007 +0000
@@ -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 @@
 fi
 
 name="clamsmtpd"
-rcvar=$name
+rcvar="${name}"
 command="@PREFIX@/sbin/${name}"
 pidfile="@VARBASE@/run/clamsmtpd.pid"
 
@@ -39,11 +39,33 @@
                        /^#/ {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 @@
 {
        @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



Home | Main Index | Thread Index | Old Index