5 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
12 abort-upgrade|abort-remove|abort-deconfigure)
17 echo "postinst called with unknown argument \`$1'" >&2
22 PATH=/bin:/usr/bin:/sbin:/usr/sbin
25 . /usr/share/amavisd-cn/version.sh
26 . /usr/share/carnet-tools/functions.sh
27 . /usr/share/amavisd-cn/variables.sh
28 . /usr/share/amavisd-cn/functions.sh
31 . /usr/share/amavisd-cn/postfix.sh
33 # $domain will be equal to $host if nothing better can be found
40 if [ -f "$ACONFOLD" ]; then
41 cp_echo "CN: Amavisd configuration is now in $ACONF."
42 noisy_backup "$ACONFOLD"
45 cp_echo "CN: Please read /usr/share/doc/amavisd-cn/README.CARNet."
46 elif [ -f "$ACONFOLD.disabled" ]; then
47 noisy_backup "$ACONFOLD.disabled" "$(basename $ACONFOLD)"
48 rm -f "$ACONFOLD.disabled"
49 cp_echo "CN: Please read /usr/share/doc/amavisd-cn/README.CARNet."
52 if [ -f $ACONF ]; then
53 # add other fixups to function update_conf(), way above
56 # nonexistent or empty config
57 if [ ! -f $ACONF -o ! -s $ACONF ]; then
58 # Create fresh config from template
63 # disable SAVI as proven problematic
64 if cp_check_and_sed "^[[:blank:]]*\['Sophos SAVI'" \
65 "s/^[[:blank:]]*\(\['Sophos SAVI', ..sophos_savi \]\)/#\1/" $ACONF; then
66 cp_echo "CN: Disabled SAVI::Perl usage in ${ACONF}."
70 check_and_add_alias virusalert root
71 check_and_add_alias spamalert root
73 # ovo je rijeseno u spamassassin-cn, i ovdje nije potrebno, stoga brisemo
74 if [ -f $AHOME/.spamassassin/user_prefs ] ; then
75 user_prefs_temp=$(mktemp /tmp/user_prefs.XXXXXX)
76 cat > $user_prefs_temp <<-EEND
77 bayes_path $AHOME/.spamassassin/bayes
79 auto_whitelist_path $AHOME/.spamassassin/auto-whitelist
81 if cmp -s $user_prefs_temp $AHOME/.spamassassin/user_prefs; then
82 rm -f $AHOME/.spamassassin/user_prefs
84 rm -f $user_prefs_temp
87 # No sysvinit order fixes
90 # Fix missing redirection in cron files for amavisd-new-cronjob
91 add_redirection /etc/cron.d/amavisd-new /etc/cron.daily/amavisd-new
93 # Cleanup and finalization
94 if dpkg --compare-versions "$2" lt 2:20030616p10-4; then
95 update-rc.d -f amavisd remove > /dev/null
98 # a complicated way to say chmod 750
99 dpkg-statoverride --remove $AHOME > /dev/null || true
100 dpkg-statoverride --update --add amavis amavis 750 $AHOME
103 if [ -n "$chown_ahome" ]; then
105 echo -n "CN: Fixing ownership in /var/*/amavis... "
106 chown -R amavis:amavis $AHOME /var/run/amavis || true
108 cp_echo -mailonly "CN: Fixed ownerships in /var/*/amavis."
111 # kill naughty pyzor descendants -- XXX needed for 2.4 or not?
112 if dpkg --compare-versions "$2" lt 2:20030616p10-7 && \
113 pgrep -u amavis -f '/usr/bin/pyzor check' > /dev/null; then
114 if [ -x "/etc/init.d/amavisd-cn" ]; then
115 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
116 invoke-rc.d amavisd-cn stop
118 /etc/init.d/amavisd-cn stop
121 pkill -9 -u amavis -f '/usr/bin/pyzor check' > /dev/null || true
122 if [ -x "/etc/init.d/amavisd-cn" ]; then
123 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
124 invoke-rc.d amavisd-cn start
126 /etc/init.d/amavisd-cn start
133 # register for automatic start
134 update-rc.d -f amavis remove >/dev/null || true
135 update-rc.d amavisd-cn defaults 19 21 >/dev/null
138 # about a half of amavisd-cn script is here
139 if [ "$restart_daemon" -a -x /etc/init.d/amavis.amavisd-new ]; then
140 if [ -x "/etc/init.d/amavis.amavisd-new" ]; then
141 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
142 invoke-rc.d amavis.amavisd-new restart
144 /etc/init.d/amavis.amavisd-new restart
148 # always check that the daemons are running
149 if ! wait_for_fds amavis; then
150 if [ -x "/etc/init.d/amavis.amavisd-new" ]; then
151 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
152 invoke-rc.d amavis.amavisd-new start
154 /etc/init.d/amavis.amavisd-new start
159 if [ "$restart_mta" ]; then
160 if [ -x "/etc/init.d/$mta" ]; then
161 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
162 invoke-rc.d $mta restart
164 /etc/init.d/$mta restart
169 # this needs to be updated when $CRONTAB file changes
170 if dpkg --compare-versions "$2" lt "2:20030616p10-4"; then
172 cp_echo "CN: Deleting temp files older than 1 day every day at 01:35 AM"
173 cp_echo "CN: Deleting spam-mail older than 7 days every day at 03:15 AM"
174 cp_echo "CN: Deleting virus-mail older than 7 days every day at 04:25 AM"
175 cp_echo " (can be changed in $CRONTAB)"
177 # This script is, hopefully, not needed any more. Hide it.
178 ## display this message just once... maybe use debconf instead
179 #if dpkg --compare-versions "$2" lt "2:20030616p10-4"; then
181 # cp_echo "CN: To stop, start or restart all of the clamav+amavis+mta components,"
182 # cp_echo "CN: use the /etc/init.d/amavisd-cn script."
184 if [ "$failed" ]; then
186 cp_echo "CN: Services $failed failed to restart!"
187 cp_echo "CN: Please check and start manually if needed."
190 # Upgrade, but no automatically changed config;
191 # warn if new template available
192 if [ -n "$2" -a -z "$changed_config" ] && \
193 dpkg --compare-versions "$2" lt "$TMPLVERSION"; then
195 cp_echo "CN: It seems you have upgraded this package from version $2."
196 cp_echo "CN: Configuration template for $mta was modified in version ${TMPLVERSION}."
197 cp_echo " You might want to review the changes, or simply copy the new template and"
198 cp_echo " and replace the _CN_DOMAIN_ string with an adequate value:"
199 cp_echo " cp $ACONFTMPL $ACONF"
200 cp_echo " perl -pi -e 's/_CN_DOMAIN_/$domain/g' $ACONF"
203 cp_mail $PKG $VERSION