tags #342644 confirmed
thanks

On Fri, Dec 09, 2005 at 09:14:10AM +0100, Bas Couwenberg wrote:
> While upgrading clamav-data from volatile today, I got the error that
> clamav-daemons database could not be reloaded.
> 
> This is due to the fact that reload-database is not an action in the
> clamav-daemon init script.

This only applies to sarge; the clamav-daemon packages in sind and
etch have the reload-database action.

> If you use restart it does work. 

...  but it will unnecessarily restart the clamav-daemon on etch and
sid.

Please try the attached postinst which will catch sarge's
/etc/init.d/clamav-daemon's error message and then invoke the
initscript again with the restart target.

A different approach would be to signal the clamav-daemon manually,
but that would mean replicating a good part of clamav-daemon's init
script in clamav-data's postinst, and we would be using an
undocumented internal interface.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
#!/bin/bash
set -e

[ $CAD_DEBUG ] && set -x

INITSCRIPT="/etc/init.d/clamav-daemon"

. /usr/share/debconf/confmodule

if [ "$1" = "configure" ]; then
  db_get clamav-data/warn-on-old-databases
  db_stop
  rm -f /var/lib/clamav-data/warn-on-old-databases
  if [ "$RET" = "true" ]; then
    touch /var/lib/clamav-data/warn-on-old-databases
  fi
  if [ -x "$INITSCRIPT" ]; then
    RET=0
    OUTPUT="$($INITSCRIPT reload-database 2>&1)" || RET=$?
    if echo $OUTPUT | grep -q "^Usage: /etc/init.d/clamav-daemon 
{start|stop|restart|force-reload}"; then
      # we have an old clamav that doesn't support reload-database
      RET=0
      $INITSCRIPT restart || RET=$?
    else
      echo >&2 $OUTPUT
    fi
    # clamav-daemon init script will return 0 on "no error" and
    # 3 on "daemon is not running".
    if [ "$RET" -ne 0 ] && [ "$RET" -ne 3 ]; then
      echo >&2 "WARN: signaling clamav-daemon to reload database failed"
    fi
    if [ "$RET" -eq 3 ]; then
      echo >&2 "WARN: clamav-daemon not running, according to init script"
    fi
  fi
fi


Reply via email to