2 # last update: zoran.dzelajlija@carnet.hr Fri, 19 Oct 2007 00:34:32 +0200
6 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
13 abort-upgrade|abort-remove|abort-deconfigure)
18 echo "postinst called with unknown argument \`$1'" >&2
23 PATH=/bin:/usr/bin:/sbin:/usr/sbin
26 . /usr/share/amavisd-cn/version.sh
27 . /usr/share/carnet-tools/functions.sh
28 . /usr/share/amavisd-cn/variables.sh
29 . /usr/share/amavisd-cn/functions.sh
31 # Place configuration tweaks done on upgrades into this function
33 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
35 # remember to set changed_config=1 and restart_daemon=1 if necessary
40 . /usr/share/amavisd-cn/postfix.sh
42 # $domain will be equal to $host if nothing better can be found
49 if [ -f "$ACONFOLD" ]; then
50 cp_echo "CN: Amavisd configuration is now in $ACONF."
51 noisy_backup "$ACONFOLD"
54 cp_echo "CN: Please read /usr/share/doc/amavisd-cn/README.CARNet."
55 elif [ -f "$ACONFOLD.disabled" ]; then
56 noisy_backup "$ACONFOLD.disabled" "$(basename $ACONFOLD)"
57 rm -f "$ACONFOLD.disabled"
58 cp_echo "CN: Please read /usr/share/doc/amavisd-cn/README.CARNet."
61 if [ -f $ACONF ]; then
62 # add other fixups to function update_conf(), way above
65 # nonexistent or empty config
66 if [ ! -f $ACONF -o ! -s $ACONF ]; then
67 # Create fresh config from template
72 # if not there, comment it out, if there, uncomment and restart
73 if ! dpkg -l libsavi-perl 2> /dev/null | egrep -q '^.i' || ! [ -f /usr/lib/libsavi.so ]; then
74 if cp_check_and_sed "^\['Sophos SAVI'" \
75 "s/^\(\['Sophos SAVI', ..sophos_savi \]\)/#\1/" $ACONF; then
76 cp_echo "CN: Disabled SAVI::Perl usage in ${ACONF}."
77 cp_echo " To enable it, run sophos-sweep-update, uncomment and restart amavis."
80 if cp_check_and_sed "^#\['Sophos SAVI'" \
81 "s/^#\(\['Sophos SAVI', ..sophos_savi \]\)/\1/" $ACONF; then
82 cp_echo "CN: Enabled SAVI::Perl usage in ${ACONF}."
87 check_and_add_alias virusalert root
88 check_and_add_alias spamalert root
90 if [ ! -f $AHOME/.spamassassin/user_prefs ] ; then
91 [ -d $AHOME/.spamassassin ] || mkdir -p $AHOME/.spamassassin
92 cat > $AHOME/.spamassassin/user_prefs <<-EEND
93 bayes_path $AHOME/.spamassassin/bayes
95 auto_whitelist_path $AHOME/.spamassassin/auto-whitelist
100 if [ ! -f $AHOME/.spamassassin/auto-whitelist ] ; then
101 touch $AHOME/.spamassassin/auto-whitelist
105 # No sysvinit order fixes
108 # Cleanup and finalization
109 if dpkg --compare-versions "$2" lt 2:20030616p10-4; then
110 update-rc.d -f amavisd remove > /dev/null
113 # a complicated way to say chmod 750
114 dpkg-statoverride --remove $AHOME > /dev/null || true
115 dpkg-statoverride --update --add amavis amavis 750 $AHOME
118 if [ -n "$chown_ahome" ]; then
120 echo -n "CN: Fixing ownership in /var/*/amavis... "
121 chown -R amavis:amavis $AHOME /var/run/amavis || true
123 cp_echo -mailonly "CN: Fixed ownerships in /var/*/amavis."
126 # kill naughty pyzor descendants -- XXX needed for 2.4 or not?
127 if dpkg --compare-versions "$2" lt 2:20030616p10-7 && \
128 pgrep -u amavis -f '/usr/bin/pyzor check' > /dev/null; then
129 /etc/init.d/amavisd-cn stop
130 pkill -9 -u amavis -f '/usr/bin/pyzor check' > /dev/null || true
131 /etc/init.d/amavisd-cn start
137 # about a half of amavisd-cn script is here
138 if [ "$restart_daemon" -a -x /etc/init.d/amavis.amavisd-new ]; then
139 /etc/init.d/amavis.amavisd-new restart
141 # always check that the daemons are running
142 if ! wait_for_fds amavis; then
143 /etc/init.d/amavis.amavisd-new start
146 if [ "$restart_mta" ]; then
147 /etc/init.d/$mta restart
150 # this needs to be updated when $CRONTAB file changes
151 if dpkg --compare-versions "$2" lt "2:20030616p10-4"; then
153 cp_echo "CN: Deleting temp files older than 1 day every day at 01:35 AM"
154 cp_echo "CN: Deleting spam-mail older than 7 days every day at 03:15 AM"
155 cp_echo "CN: Deleting virus-mail older than 7 days every day at 04:25 AM"
156 cp_echo " (can be changed in $CRONTAB)"
158 # This script is, hopefully, not needed any more. Hide it.
159 ## display this message just once... maybe use debconf instead
160 #if dpkg --compare-versions "$2" lt "2:20030616p10-4"; then
162 # cp_echo "CN: To stop, start or restart all of the clamav+amavis+mta components,"
163 # cp_echo "CN: use the /etc/init.d/amavisd-cn script."
165 if [ "$failed" ]; then
167 cp_echo "CN: Services $failed failed to restart!"
168 cp_echo "CN: Please check and start manually if needed."
171 # Upgrade, but no automatically changed config;
172 # warn if new template available
173 if [ -n "$2" -a -z "$changed_config" ] && \
174 dpkg --compare-versions "$2" lt "$TMPLVERSION"; then
176 cp_echo "CN: It seems you have upgraded this package from version $2."
177 cp_echo "CN: Configuration template for $mta was modified in version ${TMPLVERSION}."
178 cp_echo " You might want to review the changes, or simply copy the new template and"
179 cp_echo " and replace the _CN_DOMAIN_ string with an adequate value:"
180 cp_echo " cp $ACONFTMPL $ACONF"
181 cp_echo " perl -pi -e 's/_CN_DOMAIN_/$domain/g' $ACONF"
184 cp_mail $PKG $VERSION