diff -Nru clamav-0.99+dfsg/debian/changelog clamav-0.99+dfsg/debian/changelog --- clamav-0.99+dfsg/debian/changelog 2016-06-15 16:53:48.000000000 +0200 +++ clamav-0.99+dfsg/debian/changelog 2016-07-07 09:22:36.000000000 +0200 @@ -1,3 +1,9 @@ +clamav (0.99+dfsg-1ubuntu1.2) xenial; urgency=medium + + * Ensure freshclam service is run after package install (LP: #1590688) + + -- Christian Ehrhardt Thu, 07 Jul 2016 09:22:31 +0200 + clamav (0.99+dfsg-1ubuntu1.1) xenial; urgency=medium * Fix upgrade paths with proper Breaks/Replaces (LP: #1581839) diff -Nru clamav-0.99+dfsg/debian/clamav-freshclam.postinst.in clamav-0.99+dfsg/debian/clamav-freshclam.postinst.in --- clamav-0.99+dfsg/debian/clamav-freshclam.postinst.in 2016-02-15 17:26:58.000000000 +0100 +++ clamav-0.99+dfsg/debian/clamav-freshclam.postinst.in 2016-07-07 09:20:04.000000000 +0200 @@ -336,37 +336,6 @@ chown "$dbowner":adm $FRESHCLAMCONFFILE fi - - if [ "$runas" = 'daemon' ]; then - if [ -x "/etc/init.d/clamav-freshclam" ]; then - update-rc.d clamav-freshclam defaults >/dev/null - fi - if pathfind invoke-rc.d; then - invoke-rc.d clamav-freshclam start - else - /etc/init.d/clamav-freshclam start - fi - elif [ "$runas" = 'ifup.d' ]; then - for intrface in $iface; do - if route | grep -q "$intrface"; then - if pathfind invoke-rc.d; then - IFACE="$intrface" invoke-rc.d clamav-freshclam start || true - else - IFACE="$intrface" /etc/init.d/clamav-freshclam start || true - fi - break - fi - done - update-rc.d -f clamav-freshclam remove > /dev/null 2>&1 - else - echo "Starting database update: " - if pathfind invoke-rc.d; then - invoke-rc.d clamav-freshclam no-daemon || true - else - /etc/init.d/clamav-freshclam no-daemon || true - fi - update-rc.d -f clamav-freshclam remove > /dev/null 2>&1 - fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; @@ -406,4 +375,40 @@ #DEBHELPER# +# override_dh_installinit disables automatic dh_installinit/dh_systemd_start +# for freshclam provided by DEBHELPER. So invoke-rc.d has to be after +# DEBHELPER. Otherwise the it might be "started if enabled" and then enabled. +if [ "$1" = "configure" ]; then + if [ "$runas" = 'daemon' ]; then + if [ -x "/etc/init.d/clamav-freshclam" ]; then + update-rc.d clamav-freshclam defaults >/dev/null + fi + if pathfind invoke-rc.d; then + invoke-rc.d clamav-freshclam start + else + /etc/init.d/clamav-freshclam start + fi + elif [ "$runas" = 'ifup.d' ]; then + for intrface in $iface; do + if route | grep -q "$intrface"; then + if pathfind invoke-rc.d; then + IFACE="$intrface" invoke-rc.d clamav-freshclam start || true + else + IFACE="$intrface" /etc/init.d/clamav-freshclam start || true + fi + break + fi + done + update-rc.d -f clamav-freshclam remove > /dev/null 2>&1 + else + echo "Starting database update: " + if pathfind invoke-rc.d; then + invoke-rc.d clamav-freshclam no-daemon || true + else + /etc/init.d/clamav-freshclam no-daemon || true + fi + update-rc.d -f clamav-freshclam remove > /dev/null 2>&1 + fi +fi + exit 0