~ubuntu-branches/ubuntu/trusty/sendmail/trusty

« back to all changes in this revision

Viewing changes to debian/sendmail-base.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Richard A Nelson (Rick)
  • Date: 2009-03-01 18:45:00 UTC
  • mfrom: (8.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090301184500-z6683zxyomgmop6c
Tags: 8.14.3-9
Batting 1000, build-depend on quilt      Closes: #517676

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
#
 
3
# Debian post installation script
 
4
#
 
5
# Install of already installed package:
 
6
#       1) old-prerm upgrade new-version
 
7
#               *) new-prerm failed-upgrade old-version
 
8
#                       *) old-postinst abort-upgrade new-version
 
9
#
 
10
# If a `conflicting' package is being removed at the same time:
 
11
#       1) forall packages depending on conflicting package and --auto-deconfigure
 
12
#               deconfigured's-prerm deconfigure \
 
13
#                       in-favour package-being-installed version \
 
14
#                       removing conflicting-package version
 
15
#               *) deconfigured's-postinst abort-deconfigure \
 
16
#                               in-favour package-being-installed-but-failed version \
 
17
#                               removing conflicting-package version
 
18
#       2) To prepare for removal of the conflicting package
 
19
#               conflictor's-prerm remove \
 
20
#                       in-favour package new-version
 
21
#               *) conflictor's-postinst abort-remove \
 
22
#                               in-favour package new-version
 
23
#
 
24
# Configuration of package:
 
25
# postinst configure most-recently-configured-version
 
26
#
 
27
set -e;
 
28
 
 
29
PACKAGE=sendmail-base;
 
30
 
 
31
# do we have debconf?
 
32
if [ -f /usr/share/debconf/confmodule ]; then
 
33
        DEBCONF=true;
 
34
        #. /usr/share/debconf/confmodule;
 
35
        #db_stop; # For testing
 
36
else
 
37
        DEBCONF='';
 
38
        fi;
 
39
 
 
40
case "$1" in
 
41
        configure)
 
42
                #-----------------------------------------------------------
 
43
                if [ "$2" = "" ]; then
 
44
                        :;
 
45
                        #echo " ";
 
46
                        #echo "A new sendmail user, welcome!";
 
47
                        fi;
 
48
 
 
49
                #-----------------------------------------------------------
 
50
                # Tell users about new and interesting things...
 
51
                if [ -x /usr/share/sendmail/update_notices ]; then
 
52
                    /usr/share/sendmail/update_notices $2;
 
53
                    fi;
 
54
 
 
55
                #-----------------------------------------------------------
 
56
                # Create group/user smmta/smmsp iff needed
 
57
                touch /etc/mail/tsmmta;
 
58
        if ! chown root:smmta /etc/mail/tsmmta 2>/dev/null; then
 
59
            addgroup --system --quiet smmta;
 
60
            fi;
 
61
        if ! chown smmta:smmta /etc/mail/tsmmta 2>/dev/null; then
 
62
            adduser --system --ingroup smmta --home "/var/lib/sendmail" \
 
63
                --disabled-password \
 
64
                --quiet --gecos 'Mail Transfer Agent' smmta;
 
65
            fi;
 
66
        rm /etc/mail/tsmmta;    
 
67
                touch /etc/mail/tsmmsp;
 
68
                if ! chown root:smmsp /etc/mail/tsmmsp 2>/dev/null; then
 
69
                        addgroup --system --quiet smmsp;
 
70
                        fi;
 
71
                if ! chown smmsp:smmsp /etc/mail/tsmmsp 2>/dev/null; then
 
72
                        adduser --system --ingroup smmsp --home "/var/lib/sendmail" \
 
73
                                --disabled-password \
 
74
                                --quiet --gecos 'Mail Submission Program' smmsp;
 
75
                        fi;
 
76
                rm /etc/mail/tsmmsp;
 
77
 
 
78
                #-----------------------------------------------------------
 
79
                # With a dynamic uid/gid, have to set appropriate ownership herein
 
80
                chown root:smmsp /etc/mail/sasl;
 
81
                chown root:smmsp /etc/mail/tls;
 
82
 
 
83
                #-----------------------------------------------------------
 
84
                # Save the current configuration files in safe place...
 
85
                if [ -x /etc/cron.daily/sendmail ]; then
 
86
                        echo "Saving current /etc/mail/sendmail.mc,cf to /var/backups";
 
87
                        /etc/cron.daily/sendmail || true;
 
88
                        fi;
 
89
 
 
90
                #-----------------------------------------------------------
 
91
                # Make sure inetd.conf has sendmail in it (but disabled)
 
92
                if [ -x /usr/sbin/update-inetd ]; then
 
93
                        update-inetd --remove "^587";
 
94
                        update-inetd --group MAIL --add \
 
95
                                "smtp\tstream\ttcp\tnowait\troot\t/usr/sbin/sendmail sendmail -Am -bs";
 
96
                        update-inetd --group MAIL --add \
 
97
                                "submission\tstream\ttcp\tnowait\troot\t/usr/sbin/sendmail sendmail -Am -bs";
 
98
                        update-inetd --group MAIL --add \
 
99
                                "smtps\tstream\ttcp\tnowait\troot\t/usr/sbin/sendmail sendmail -Am -bs";
 
100
                        update-inetd --group MAIL --multi --disable smtp,smtps,submission;
 
101
                        fi;     
 
102
 
 
103
                ;;
 
104
 
 
105
        abort-upgrade|abort-remove|abort-deconfigure)
 
106
                exit 0;
 
107
                ;;
 
108
 
 
109
        *)
 
110
                echo "$PACKAGE postinst called with unknown argument \`$1'" >&2;
 
111
                exit 1;
 
112
                ;;
 
113
        esac;
 
114
 
 
115
#DEBHELPER#
 
116
exit 0;