~ubuntu-branches/ubuntu/dapper/mailscanner/dapper

« back to all changes in this revision

Viewing changes to debian/postinst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2004-05-06 07:13:51 UTC
  • Revision ID: james.westby@ubuntu.com-20040506071351-myyd25t1zk6ifcmb
Tags: 4.30.3-2
* Fix paths in ConfigDefs.pl (closes: #247632).
* Suggest libnet-ldap-perl (closes: #247633).
* Use ctime instead of atime in daily cron script (closes: #247699).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
# postinst script for mailscanner
 
3
#
 
4
# see: dh_installdeb(1)
 
5
 
 
6
statedir="/var/lib/MailScanner"
 
7
 
 
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>
 
12
#          <new-version>
 
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/
 
17
#
 
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'.
 
24
 
 
25
. /usr/share/debconf/confmodule
 
26
 
 
27
install_default()
 
28
{
 
29
    if [ ! -f /etc/default/mailscanner ]; then
 
30
        cat > /etc/default/mailscanner <<-EOF
 
31
        #
 
32
        # This sets how many days files will remain in the "quarantine" area before
 
33
        # being automatically removed.
 
34
        #
 
35
        q_days=7
 
36
        
 
37
        #
 
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
 
41
        # tasks.
 
42
        #
 
43
        run_nice=2
 
44
        
 
45
        #
 
46
        # Uncomment this line once MailScanner has been fully configured.
 
47
        #
 
48
        #run_mailscanner=1
 
49
        EOF
 
50
    fi
 
51
}
 
52
 
 
53
#UCF#
 
54
 
 
55
case "$1" in
 
56
    configure)
 
57
        domain=`hostname -d`
 
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
 
64
            then
 
65
                rm -f /etc/MailScanner/MailScanner.conf.new
 
66
            else
 
67
                mv -f /etc/MailScanner/MailScanner.conf.new \
 
68
                    /etc/MailScanner/MailScanner.conf
 
69
            fi
 
70
        fi
 
71
 
 
72
#       install_default # currently a conffile, instead
 
73
 
 
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
 
86
                        else
 
87
                            rm -f $dir/$file
 
88
                        fi
 
89
                    else
 
90
                        mv $dir/$file $statedir/$file
 
91
                    fi
 
92
                fi
 
93
            done
 
94
            rm -f $dir/bayes.* || true
 
95
            rmdir $dir >/dev/null 2>&1 || true
 
96
        done
 
97
        rm -rf /var/spool/mailscanner
 
98
    ;;
 
99
 
 
100
    abort-upgrade|abort-remove|abort-deconfigure)
 
101
 
 
102
    ;;
 
103
 
 
104
    *)
 
105
        echo "postinst called with unknown argument \`$1'" >&2
 
106
        exit 0
 
107
    ;;
 
108
esac
 
109
 
 
110
# dh_installdeb will replace this with shell code automatically
 
111
# generated by other debhelper scripts.
 
112
 
 
113
#DEBHELPER#
 
114
 
 
115
exit 0