6b3e95047ce4fe1473adf53f4610c9bd785965fd
[clamav-cn.git] / debian / postinst
1 #!/bin/sh
2
3 set -e
4
5 [ "$1" = "configure" ] || exit 0
6 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
7
8 # Load CARNet functions
9 . /usr/share/carnet-tools/functions.sh
10
11 cp_check_and_sed "^AllowSupplementaryGroups false" \
12                  "s/AllowSupplementaryGroups false/AllowSupplementaryGroups true/g" \
13                  /etc/clamav/clamd.conf && restart="yes" || true
14
15 if ! grep -q ^AllowSupplementaryGroups /etc/clamav/clamd.conf; then
16   echo "AllowSupplementaryGroups true" >> /etc/clamav/clamd.conf
17   reload="yes"
18 fi
19
20 chown -R clamav:clamav /var/run/clamav /var/lib/clamav /var/log/clamav
21
22 # dodaj korisnika clamav u grupu amavis (ako postoji...)
23 getent group amavis > /dev/null && usermod -G amavis clamav && restart="yes"
24
25 # ispravi opciju od clamscana u amavis konfi
26 # --disable-summary -> --no-summary
27 if [ -f /etc/amavis/conf.d/15-av_scanners ]; then
28   cp_check_and_sed "\-\-disable-summary" \
29                    "s/--disable-summary/--no-summary/g" \
30                    /etc/amavis/conf.d/15-av_scanners && restart_amavis="yes" || true
31
32   if [ -f /etc/amavis/conf.d/15-av_scanners.cn-old ]; then
33     rm -f /etc/amavis/conf.d/15-av_scanners.cn-old
34   fi
35 fi
36
37 # izbaciti MSRBL
38 if ! grep -q "^unset msrbl_dbs" /etc/clamav-unofficial-sigs.conf; then
39   echo "unset msrbl_dbs" >> /etc/clamav-unofficial-sigs.conf
40 fi
41
42 if [ "$restart_amavis" = "yes" ]; then
43   if [ -x /usr/sbin/invoke-rc.d ]; then
44     [ -x /etc/init.d/amavisd-cn ] && invoke-rc.d amavisd-cn restart
45   else
46     [ -x /etc/init.d/amavisd-cn ] && /etc/init.d/amavisd-cn restart
47   fi
48   # nije potreban restart clamava
49   restart="no"
50 fi
51
52
53 # restart if needed
54 [ "$restart" = "yes" ] || exit 0
55 if [ -x /usr/sbin/invoke-rc.d ]; then
56   [ -x /etc/init.d/clamav-daemon ] && invoke-rc.d clamav-daemon restart
57 else
58   [ -x /etc/init.d/clamav-daemon ] && /etc/init.d/clamav-daemon restart
59 fi
60
61 if [ -x /usr/sbin/invoke-rc.d ]; then
62   [ -x /etc/init.d/clamav-freshclam ] && invoke-rc.d clamav-freshclam restart
63 else
64   [ -x /etc/init.d/clamav-freshclam ] && /etc/init.d/clamav-freshclam restart
65 fi
66
67 #DEBHELPER#