Povecanje ovisnosti na verziju iz buster-updates
[clamav-cn.git] / debian / postinst
index 40eb973..a92f09d 100755 (executable)
@@ -5,72 +5,50 @@ set -e
 [ "$1" = "configure" ] || exit 0
 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
 
-# Load CARNet functions
+# Load CARNET Tools
 . /usr/share/carnet-tools/functions.sh
 
-#if dpkg --compare-versions "$2" lt 2:0.91.1-1 ; then
-#  cp_backup_conffile /etc/clamav/clamd.conf
-#  rm -f /etc/clamav/clamd.conf
-#  cp -a /usr/share/doc/clamav-cn/examples/clamd.conf /etc/clamav/clamd.conf
-#  restart="yes"
-#fi
-#
-#if dpkg --compare-versions "$2" lt 2:0.91.1-1 ; then
-#  cp_backup_conffile /etc/clamav/freshclam.conf
-#  rm -f /etc/clamav/freshclam.conf
-#  cp -a /usr/share/doc/clamav-cn/examples/freshclam.conf /etc/clamav/freshclam.conf
-#  restart="yes"
-#fi
-
-cp_check_and_sed "^AllowSupplementaryGroups false" \
-                 "s/AllowSupplementaryGroups false/AllowSupplementaryGroups true/g" \
+# obsolete option
+cp_check_and_sed "^AllowSupplementaryGroups" \
+                 "s/^AllowSupplementaryGroups/#AllowSupplementaryGroups/g" \
                  /etc/clamav/clamd.conf && restart="yes" || true
 
-if ! grep -q ^AllowSupplementaryGroups /etc/clamav/clamd.conf; then
-  echo "AllowSupplementaryGroups true" >> /etc/clamav/clamd.conf
-  reload="yes"
-fi
+# obsolete option SafeBrowsing https://blog.clamav.net/2021/04/clamav-01032-security-patch-release.html
+cp_check_and_sed "^SafeBrowsing" \
+                 "s/^SafeBrowsing/#SafeBrowsing/g" \
+                 /etc/clamav/freshclam.conf && restart="yes" || true
 
-chown -R clamav:clamav /var/run/clamav /var/lib/clamav /var/log/clamav
+# dodaj staru opciju PidFIle kako bi monit pouzdano radio
+cp_check_and_sed "^#PidFile" \
+                 "s,^#PidFile /var/run/clamav/clamd.pid,PidFile /var/run/clamav/clamd.pid,g" \
+                 /etc/clamav/clamd.conf && restart="yes" || true
+# za svaki slučaj ako je neka druga putanja
+cp_check_and_sed "^PidFile" \
+                 "s,^PidFile.*,PidFile /var/run/clamav/clamd.pid,g" \
+                 /etc/clamav/clamd.conf && restart="yes" || true
 
-# dodaj korisnika clamav u grupu amavis (ako postoji...)
-getent group amavis > /dev/null && usermod -G amavis clamav && restart="yes"
+if [ -d /var/run/clamav ]; then
+  chown -R clamav:clamav /var/run/clamav
+fi
 
-# ispravi opciju od clamscana u amavis konfi
-# --disable-summary -> --no-summary
-if [ -f /etc/amavis/conf.d/15-av_scanners ]; then
-  cp_check_and_sed "\-\-disable-summary" \
-                  "s/--disable-summary/--no-summary/g" \
-                  /etc/amavis/conf.d/15-av_scanners && restart_amavis="yes" || true
+if [ -d /run/clamav ]; then
+  chown -R clamav:clamav /run/clamav
+fi
 
-  if [ -f /etc/amavis/conf.d/15-av_scanners.cn-old ]; then
-    rm -f /etc/amavis/conf.d/15-av_scanners.cn-old
-  fi
+if [ -d /var/lib/clamav ]; then
+  chown -R clamav:clamav /var/lib/clamav
 fi
 
-if [ "$restart_amavis" = "yes" ]; then
-  if [ -x /usr/sbin/invoke-rc.d ]; then
-    [ -x /etc/init.d/amavisd-cn ] && invoke-rc.d amavisd-cn restart
-  else
-    [ -x /etc/init.d/amavisd-cn ] && /etc/init.d/amavisd-cn restart
-  fi
-  # nije potreban restart clamava
-  restart="no"
+if [ -d /var/log/clamav ]; then
+  chown -R clamav:clamav /var/log/clamav
 fi
 
+# dodaj korisnika clamav u grupu amavis (ako postoji...)
+getent group amavis > /dev/null && usermod -G amavis clamav && restart="yes"
 
 # restart if needed
 [ "$restart" = "yes" ] || exit 0
-if [ -x /usr/sbin/invoke-rc.d ]; then
-  [ -x /etc/init.d/clamav-daemon ] && invoke-rc.d clamav-daemon restart
-else
-  [ -x /etc/init.d/clamav-daemon ] && /etc/init.d/clamav-daemon restart
-fi
-
-if [ -x /usr/sbin/invoke-rc.d ]; then
-  [ -x /etc/init.d/clamav-freshclam ] && invoke-rc.d clamav-freshclam restart
-else
-  [ -x /etc/init.d/clamav-freshclam ] && /etc/init.d/clamav-freshclam restart
-fi
+service clamav-daemon restart
+service clamav-freshclam restart
 
 #DEBHELPER#