-ACONFTMPL=$POSTTMPL
-TMPLVERSION=$POSTTMPLVERSION
-if dpkg -l postfix | grep -q '^.i'; then
- . /usr/share/amavisd-cn/postfix.sh
-elif dpkg -l sendmail | grep -q '^.i'; then
- mta=sendmail
- ACONFTMPL=$SENDTMPL
- TMPLVERSION=$SENDTMPLVERSION
- . /usr/share/amavisd-cn/sendmail.sh
-else
- # should never happen, we check for this in preinst too!
- echo "CN: Ugh, no supported mail-transported-agent could be found?!" >&2
- echo "CN: If you really have a MTA supported by CARNet installed," >&2
- echo "CN: Please inform the maintainer. Assuming ${mta}..." >&2
-fi
-
-# XXX remove at least some of woody cruft for CARNet Debian 2.1+1
-# convert sweep-cn back to "sweep" account, fix uid/gid
-if getent passwd sweep > /dev/null; then
- check_and_update_ugid sweep /etc/sweep /var/lib/sav /var/spool/intercheck /var/log/sweep.log || true
- # chown stuff I forgot in previous versions
- if dpkg --compare-versions "$2" lt 20030616p10-3; then
- chown -R sweep:sweep /var/spool/intercheck /var/log/sweep.log 2> /dev/null || true
- fi
- if cp_check_and_sed viruser s/viruser/sweep/ /etc/cron.d/sweep-cn /usr/bin/sophos-ide-update; then
- did_sweep="sweep "
- fi
- if cp_check_and_sed viruser "s/sweep viruser/sweep/g; s/viruser/sweep/g" /etc/samba/smb.conf; then
- /etc/init.d/samba reload || true
- did_sweep="${did_sweep}smb.conf "
- fi
-fi # sweep
-
-# get rid of viruser
-if getent passwd viruser > /dev/null || [ -n "$did_sweep" ]; then
- # remove viruser account usage
- echo -n "CN: Removing viruser: "
- [ "$did_sweep" ] && echo -n "$did_sweep"
- if cp_check_and_sed '^viruser' s/viruser/clamav/ $ALIASES; then
- newaliases 2>&1 > /dev/null
- echo -n "aliases "
- fi
- if cp_check_and_sed "User viruser" \
- s/viruser/clamav/ /etc/clamav/clamd.conf; then
- clamav_changed=1
- fi
- if cp_check_and_sed "DatabaseOwner viruser" \
- s/viruser/clamav/ /etc/clamav/freshclam.conf; then
- clamav_changed=1
- fi
- if [ -n "$clamav_changed" ]; then
- # add clamav to amavis group
- echo -n "c"
- id clamav | grep -q amavis || adduser clamav amavis > /dev/null
- echo -n "l"
- /etc/init.d/clamav-daemon stop > /dev/null || true
- pkill -9 /usr/sbin/clamd || true
- echo -n "a"
- /etc/init.d/clamav-freshclam stop > /dev/null || true
- pkill -9 /usr/bin/freshclam || true
- echo -n "m"
- chown -R clamav:clamav \
- /var/lib/clamav /var/log/clamav /var/run/clamav || true
- echo -n "a"
- # Don't abort if clamav services do not restart.
- /etc/init.d/clamav-daemon start > /dev/null || failed clamav-daemon
- /etc/init.d/clamav-freshclam start > /dev/null || failed clamav-freshclam
- echo -n "v "
- fi
- # We'll catch other changes later, just fix user now
- if cp_check_and_sed '$daemon_user.*viruser' s/viruser/amavis/g $ACONF; then
- stop_amavisd_now=1
- fi
- if getent passwd viruser >/dev/null; then
- if ls -lnG /var/run/amavis $AHOME |grep -q " $(id -u viruser) " || \
- pgrep -u viruser -f /usr/sbin/amavis-milter > /dev/null || \
- pgrep -u viruser amavisd > /dev/null; then
- stop_amavisd_now=1
- fi
- fi
- if [ -n "$stop_amavisd_now" ]; then
- echo -n "a"
- if [ -x /etc/init.d/$mta ]; then
- /etc/init.d/$mta stop > /dev/null
- else
- # shouldn't happen either XXX catch it and send to maintainer?
- echo -n "iee, no init script for $mta! ignoring... a"
- fi
- echo -n "m"
- if [ -x /etc/init.d/amavisd-new-milter ]; then
- /etc/init.d/amavisd-new-milter stop > /dev/null
- fi
- echo -n "a"
- pkill -9 -u viruser -f /usr/sbin/amavis-milter || true
- echo -n "v"
- /etc/init.d/amavis stop > /dev/null
- echo -n "i"
- pkill -9 -u viruser -x amavisd || true
- chown_ahome=1 # do it later
- echo -n "s "
- restart_daemon=1
- [ $mta = sendmail ] && restart_milter=1 || true
- restart_mta=1
- fi
- if getent passwd viruser >/dev/null; then
- echo -n "userdel"
- userdel viruser
- fi
- echo "."
- cp_echo -mailonly "CN: Removed user viruser."
-fi # viruser
-# added later
-if cp_check_and_sed viruser s/viruser/clamav/ \
- /etc/logrotate.d/clamav-daemon /etc/logrotate.d/clamav-freshclam; then
- :
-fi # viruser