~ubuntu-branches/ubuntu/raring/clamav/raring

« back to all changes in this revision

Viewing changes to debian/clamav-daemon.postinst.in

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2008-09-05 17:25:34 UTC
  • mto: (0.35.3 sid)
  • mto: This revision was merged to the branch mainline in revision 51.
  • Revision ID: james.westby@ubuntu.com-20080905172534-2lxrdzafr26tqfkx
Tags: 0.94.dfsg-1
* New upstream version (closes: #497662, #497773)
  - lots of new options for clamd.conf
  - fixes CVEs CVE-2008-3912, CVE-2008-3913, CVE-2008-3914, and
    CVE-2008-1389
* No longer supports --unzip option, so typo is gone (closes: #496276)
* Translations:
  - sv (thanks Martin Bagge <brother@bsnet.se>) (closes: #491760)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# postinst script for #PACKAGE#
 
3
#
 
4
# see: dh_installdeb(1)
 
5
 
 
6
set -e
 
7
 
 
8
# summary of how this script can be called:
 
9
#        * <postinst> `configure' <most-recently-configured-version>
 
10
#        * <old-postinst> `abort-upgrade' <new version>
 
11
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
 
12
#          <new-version>
 
13
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
 
14
#          <failed-install-package> <version> `removing'
 
15
#          <conflicting-package> <version>
 
16
# for details, see http://www.debian.org/doc/debian-policy/ or
 
17
# the debian-policy package
 
18
#
 
19
# quoting from the policy:
 
20
#     Any necessary prompting should almost always be confined to the
 
21
#     post-installation script, and should be protected with a conditional
 
22
#     so that unnecessary prompting doesn't happen if a package's
 
23
#     installation fails and the `postinst' is called with `abort-upgrade',
 
24
#     `abort-remove' or `abort-deconfigure'.
 
25
 
 
26
#COMMON-FUNCTIONS#
 
27
 
 
28
case "$1" in
 
29
  configure)
 
30
 
 
31
  UCFVER=`check_ucf`
 
32
 
 
33
  CLAMAVCONF=/etc/clamav/clamd.conf
 
34
  DEBROTATEFILE=/var/lib/clamav/clamdrotate.debconf
 
35
  CLAMAVROTATEFILE=/etc/logrotate.d/clamav-daemon
 
36
  
 
37
  slurp_config "$CLAMAVCONF"
 
38
 
 
39
  if [ -n "$LogFile" ]; then
 
40
    if echo "$LogFile" | grep -q '^/dev/'; then
 
41
      make_logrotate=false
 
42
    else
 
43
      make_logrotate=true
 
44
    fi
 
45
    [ -n "$User" ] || User=clamav
 
46
    if [ "$make_logrotate" = 'true' ]; then
 
47
      echo "$LogFile {" > $DEBROTATEFILE
 
48
      echo "     rotate 12" >> $DEBROTATEFILE
 
49
      echo "     weekly" >> $DEBROTATEFILE
 
50
      echo "     compress" >> $DEBROTATEFILE
 
51
      echo "     delaycompress" >> $DEBROTATEFILE
 
52
      echo "     create 640  $User adm" >> $DEBROTATEFILE
 
53
      echo "     postrotate" >> $DEBROTATEFILE
 
54
      echo "     /etc/init.d/clamav-daemon reload-log > /dev/null" >> $DEBROTATEFILE
 
55
      echo "     endscript" >> $DEBROTATEFILE
 
56
      echo "     }" >> $DEBROTATEFILE
 
57
      touch "$LogFile"
 
58
      chown "$User":adm "$LogFile"
 
59
      chmod 0640 "$LogFile"
 
60
      ucf_cleanup "$CLAMAVROTATEFILE"
 
61
      ucf_upgrade_check "$CLAMAVROTATEFILE" "$DEBROTATEFILE" /var/lib/ucf/cache/:etc:logrotate.d:clamav-daemon
 
62
      rm -f $DEBROTATEFILE
 
63
    else
 
64
      if [ -e "$CLAMAVROTATEFILE" ]; then
 
65
        echo "Disabling old logrotate script for clamav-daemon"
 
66
        mv "$CLAMAVROTATEFILE" "$CLAMAVROTATEFILE".dpkg-old
 
67
        ucf -p "$CLAMAVROTATEFILE"
 
68
      fi
 
69
    fi
 
70
  else
 
71
    if [ -e "$CLAMAVROTATEFILE" ]; then
 
72
      echo "Disabling old logrotate script for clamav-daemon"
 
73
      mv "$CLAMAVROTATEFILE" "$CLAMAVROTATEFILE".dpkg-old
 
74
      ucf -p "$CLAMAVROTATEFILE"
 
75
    fi
 
76
  fi
 
77
 
 
78
  ;;
 
79
  abort-upgrade|abort-remove|abort-deconfigure)
 
80
  ;;
 
81
  *)
 
82
  echo "postinst called with unknown argument \`$1'" >&2
 
83
  exit 1
 
84
  ;;
 
85
esac
 
86
 
 
87
# dh_installdeb will replace this with shell code automatically
 
88
# generated by other debhelper scripts.
 
89
 
 
90
#DEBHELPER#
 
91
 
 
92
exit 0