2 # postinst script for amavisd-cn
4 # see: dh_installdeb(1)
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>
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
20 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
27 abort-upgrade|abort-remove|abort-deconfigure)
32 echo "postinst called with unknown argument \`$1'" >&2
37 PATH=/bin:/usr/bin:/sbin:/usr/sbin
40 . /usr/share/amavisd-cn/version.sh
41 . /usr/share/carnet-tools/functions.sh
42 . /usr/share/amavisd-cn/variables.sh
43 . /usr/share/amavisd-cn/functions.sh
46 . /usr/share/amavisd-cn/postfix.sh
48 # $domain will be equal to $host if nothing better can be found
55 if [ -f "$ACONFOLD" ]; then
56 cp_echo "CN: Amavisd configuration is now in $ACONF."
57 noisy_backup "$ACONFOLD"
60 cp_echo "CN: Please read /usr/share/doc/amavisd-cn/README.CARNet."
61 elif [ -f "$ACONFOLD.disabled" ]; then
62 noisy_backup "$ACONFOLD.disabled" "$(basename $ACONFOLD)"
63 rm -f "$ACONFOLD.disabled"
64 cp_echo "CN: Please read /usr/share/doc/amavisd-cn/README.CARNet."
67 if [ -f $ACONF ]; then
68 # add other fixups to function update_conf(), way above
71 # nonexistent or empty config
72 if [ ! -f $ACONF -o ! -s $ACONF ]; then
73 # Create fresh config from template
78 # disable SAVI as proven problematic
79 if cp_check_and_sed "^[[:blank:]]*\['Sophos SAVI'" \
80 "s/^[[:blank:]]*\(\['Sophos SAVI', ..sophos_savi \]\)/#\1/" $ACONF; then
81 cp_echo "CN: Disabled SAVI::Perl usage in ${ACONF}."
85 check_and_add_alias virusalert root
86 check_and_add_alias spamalert root
88 # ovo je rijeseno u spamassassin-cn, i ovdje nije potrebno, stoga brisemo
89 if [ -f $AHOME/.spamassassin/user_prefs ] ; then
90 user_prefs_temp=$(mktemp /tmp/user_prefs.XXXXXX)
91 cat > $user_prefs_temp <<-EEND
92 bayes_path $AHOME/.spamassassin/bayes
94 auto_whitelist_path $AHOME/.spamassassin/auto-whitelist
96 if cmp -s $user_prefs_temp $AHOME/.spamassassin/user_prefs; then
97 rm -f $AHOME/.spamassassin/user_prefs
99 rm -f $user_prefs_temp
102 # No sysvinit order fixes
105 # Fix missing redirection in cron files for amavisd-new-cronjob
106 add_redirection /etc/cron.d/amavisd-new
108 if [ -n "$chown_ahome" ]; then
110 echo -n "CN: Fixing ownership in /var/*/amavis... "
111 chown -R amavis:amavis $AHOME /var/run/amavis || true
113 cp_echo -mailonly "CN: Fixed ownerships in /var/*/amavis."
117 if [ "$restart_daemon" -a -x /etc/init.d/amavis ]; then
118 if [ -x "/etc/init.d/amavis" ]; then
119 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
120 invoke-rc.d amavis restart
122 /etc/init.d/amavis restart
126 # always check that the daemons are running
128 # this needs to be updated when $CRONTAB file changes
129 if dpkg --compare-versions "$2" lt "2:20030616p10-4"; then
131 cp_echo "CN: Deleting temp files older than 1 day every day at 01:35 AM"
132 cp_echo "CN: Deleting spam-mail older than 7 days every day at 03:15 AM"
133 cp_echo "CN: Deleting virus-mail older than 7 days every day at 04:25 AM"
134 cp_echo " (can be changed in $CRONTAB)"
137 if [ "$failed" ]; then
139 cp_echo "CN: Services $failed failed to restart!"
140 cp_echo "CN: Please check and start manually if needed."
143 # Upgrade, but no automatically changed config;
144 # warn if new template available
145 if [ -n "$2" -a -z "$changed_config" ] && \
146 dpkg --compare-versions "$2" lt "$TMPLVERSION"; then
148 cp_echo "CN: It seems you have upgraded this package from version $2."
149 cp_echo "CN: Configuration template for $mta was modified in version ${TMPLVERSION}."
150 cp_echo " You might want to review the changes, or simply copy the new template and"
151 cp_echo " and replace the _CN_DOMAIN_ string with an adequate value:"
152 cp_echo " cp $ACONFTMPL $ACONF"
153 cp_echo " perl -pi -e 's/_CN_DOMAIN_/$domain/g' $ACONF"
156 # Delete old conffiles...
157 for conffile in /etc/logcheck/violations.ignore.d/amavisd-new \
158 /etc/logcheck/ignore.d.server/amavisd-new \
159 /etc/logcheck/ignore.d.workstation/amavisd-new \
160 /etc/cron.daily/amavisd-new; do
161 if [ -f ${conffile} ]; then
162 cp_echo "CN: Deleting old conffile ${conffile}..."
167 cp_mail $PKG $VERSION