Marc Haber wrote: >>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.
True, I only checked the local init script, which if not even the Sarge version but the one from volatile. >>If you use restart it does work. > > ... but it will unnecessarily restart the clamav-daemon on etch and > sid. True, I didn't really think of that. > 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. I've tested the postinst, but it does not work with the volatile clamav-daemon init script. The volatile version gives: Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload|reload-log} While the Sarge version gives: Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload} It should work with both versions of the init script when you use: grep -q "^Usage: /etc/init.d/clamav-daemon {start|stop|restart|force-reload" I've attached my working version with the above fix. > 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 I don't that is necessary, your aproach to only restart if the init complains seems to work fine. Regards, Bas -- GnuPG: 0x77A975AD
#!/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
signature.asc
Description: OpenPGP digital signature