izmjene u postinstu
[clamav-cn.git] / debian / postinst
index 22416db..414f933 100755 (executable)
@@ -3,39 +3,34 @@
 set -e
 
 [ "$1" = "configure" ] || exit 0
 set -e
 
 [ "$1" = "configure" ] || exit 0
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
 
 
-# Load CARNet functions
-#. /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
-
-chown -R clamav:clamav /var/run/clamav /var/lib/clamav /var/log/clamav
+# Load CARNet Tools
+. /usr/share/carnet-tools/functions.sh
+
+# obsolete option
+cp_check_and_sed "^AllowSupplementaryGroups" \
+                 "s/^AllowSupplementaryGroups/#AllowSupplementaryGroups/g" \
+                 /etc/clamav/clamd.conf && restart="yes" || true
+
+if [ -d /run/clamav ]; then
+  chown -R clamav:clamav /run/clamav
+fi
+
+if [ -d /var/lib/clamav ]; then
+  chown -R clamav:clamav /var/lib/clamav
+fi
+
+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
 
 # 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
+service clamav-daemon restart
+service clamav-freshclam restart
 
 
-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
+#DEBHELPER#