r11: Preliminary etch package.
[amavisd-cn.git] / debian / init
index 8af8212..62f701f 100755 (executable)
@@ -7,7 +7,6 @@ set -e
 options='
 clamd  clamav-daemon           clamav  /usr/sbin/clamd         clamav/clamd.pid                5       clamav.log
 amavis amavis.amavisd-new      amavis  amavisd \\(master\\)    amavis/amavisd.pid              5       socket
-milter amavisd-new-milter      amavis  /usr/sbin/amavis-milter amavis/amavisd-new-milter.pid   5       socket
 '
 # note: pgrep -f takes a regexp, and this is shell expanded once, hence \\
 
@@ -61,7 +60,7 @@ wait_for_fds () {
   IFS="$IFSOLD"
   num=${num:-4}
   sleep=${sleep:-1}
-  maxtry=${maxtry:-10}
+  maxtry=${maxtry:-90}
   if [ -n "$pidfile" ]; then
     pidfile=/var/run/$pidfile
     findpid="[ -f $pidfile ] && cat $pidfile || true"
@@ -75,10 +74,11 @@ wait_for_fds () {
   do
     sleep $sleep                           # 1st, give it a chance to run
     pid=`eval $findpid`                    # 2nd: find it
-    [ -z "$pid" ]           && return 1    # not running at all
-    count=`ls -1 /proc/$pid/fd 2>/dev/null| wc -l`    # 3rd: count all it's worth
-    [ "$count" -ge "$num" ] && ls -l /proc/$pid/fd | grep -q $fdname \
-                            && return      # success -- release
+    if [ ! -z "$pid" ]; then
+           count=`ls -1 /proc/$pid/fd 2>/dev/null| wc -l`    # 3rd: count all it's worth
+           [ "$count" -ge "$num" ] && ls -l /proc/$pid/fd | grep -q $fdname \
+                                   && return      # success -- release
+    fi
     try=$(($try+1))
     [ "0$try" -ge "0$maxtry" ] && return 1 # no luck this time
   done
@@ -105,11 +105,7 @@ esac
 # If there's no diversion, play possum
 [ -x /etc/init.d/amavis.amavisd-new ] || exit 0
 
-if [ -x /etc/init.d/postfix -a -x /usr/lib/postfix/master ]; then
-  mta=postfix
-else
-  mta=sendmail
-fi
+mta=postfix
 
 case "$arg" in
   start|stop|restart|reload|force-reload)
@@ -119,13 +115,11 @@ case "$arg" in
   istart)
        start clamd
        start amavis
-       [ $mta = sendmail ] && start milter
        /etc/init.d/$mta start
        ;;
 
   istop)
        /etc/init.d/$mta stop
-       [ $mta = sendmail ] && stop milter
        stop amavis
        stop clamd
        ;;