2
# postinst script for mailscanner
4
# see: dh_installdeb(1)
6
statedir="/var/lib/MailScanner"
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 /usr/share/doc/packaging-manual/
18
# quoting from the policy:
19
# Any necessary prompting should almost always be confined to the
20
# post-installation script, and should be protected with a conditional
21
# so that unnecessary prompting doesn't happen if a package's
22
# installation fails and the `postinst' is called with `abort-upgrade',
23
# `abort-remove' or `abort-deconfigure'.
25
. /usr/share/debconf/confmodule
29
if [ ! -f /etc/default/mailscanner ]; then
30
cat > /etc/default/mailscanner <<-EOF
32
# This sets how many days files will remain in the "quarantine" area before
33
# being automatically removed.
38
# This sets how much the priority of the mailscanner daemon should be
39
# reduced by (i.e. "nice -X"). Since it is a batch oriented task,
40
# there it can easily give up some CPU cycles to more interactive
46
# Uncomment this line once MailScanner has been fully configured.
58
if [ -n "$domain" ]; then
59
sed -e "s/put\.your\.domain\.name\.here/$domain/" \
60
/etc/MailScanner/MailScanner.conf \
61
> /etc/MailScanner/MailScanner.conf.new
62
if cmp -s /etc/MailScanner/MailScanner.conf \
63
/etc/MailScanner/MailScanner.conf.new
65
rm -f /etc/MailScanner/MailScanner.conf.new
67
mv -f /etc/MailScanner/MailScanner.conf.new \
68
/etc/MailScanner/MailScanner.conf
72
# install_default # currently a conffile, instead
74
# move files from any previously installed location
75
for dir in /var/spool/MailScanner /var/spool/mailscanner \
76
/var/state/MailScanner /var/state/mailscanner \
77
/var/lib/MailScanner /var/lib/mailscanner \
78
~root/.spamassassin ~mail/.spamassassin; do
79
if [ "$dir" = "$statedir" ]; then continue; fi
80
if [ ! -d "$dir" ]; then continue; fi
81
for file in auto-whitelist bayes_journal bayes_msgcount bayes_seen bayes_toks; do
82
if [ -f $dir/$file ]; then
83
if [ -f $statedir/$file ]; then
84
if [ $dir/$file -nt $statedir/$file ]; then
85
mv $dir/$file $statedir/$file
90
mv $dir/$file $statedir/$file
94
rm -f $dir/bayes.* || true
95
rmdir $dir >/dev/null 2>&1 || true
97
rm -rf /var/spool/mailscanner
100
abort-upgrade|abort-remove|abort-deconfigure)
105
echo "postinst called with unknown argument \`$1'" >&2
110
# dh_installdeb will replace this with shell code automatically
111
# generated by other debhelper scripts.