~ubuntu-branches/ubuntu/saucy/postfix/saucy

« back to all changes in this revision

Viewing changes to debian/init.d

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2011-02-22 11:20:43 UTC
  • mfrom: (1.1.27 upstream)
  • Revision ID: james.westby@ubuntu.com-20110222112043-c34ht219w3ybrilr
Tags: 2.8.0-2
* a little more lintian cleanup
* Fix missing format strings in smtp-sink.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
# Provides:          postfix mail-transport-agent
10
10
# Required-Start:    $local_fs $remote_fs $syslog $named $network $time
11
11
# Required-Stop:     $local_fs $remote_fs $syslog $named $network
12
 
# Should-Start:      postgresql mysql clamav-daemon postgrey spamassassin
13
 
# Should-Stop:       postgresql mysql clamav-daemon postgrey spamassassin
 
12
# Should-Start:      postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
 
13
# Should-Stop:       postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
14
14
# Default-Start:     2 3 4 5
15
15
# Default-Stop:      0 1 6
16
16
# Short-Description: start and stop the Postfix Mail Transport Agent
72
72
                # Make sure that the chroot environment is set up correctly.
73
73
                oldumask=$(umask)
74
74
                umask 022
75
 
                cd $(postconf -h queue_directory)
76
 
 
77
 
                # if we're using tls, then we need to add etc/ssl/certs/ca-certificates.crt.
78
 
                if [ -f "/etc/ssl/certs/ca-certificates.crt" ]; then 
79
 
                    smtp_use_tls=$(postconf -h smtp_use_tls)
80
 
                    smtp_enforce_tls=$(postconf -h smtp_enforce_tls)
81
 
                    smtpd_use_tls=$(postconf -h smtpd_use_tls)
82
 
                    smtpd_enforce_tls=$(postconf -h smtpd_use_tls)
83
 
                    case :$smtp_use_tls:$smtp_enforce_tls:$smtpd_use_tls:$smtpd_enforce_tls: in
84
 
                        *:yes:*)
85
 
                            mkdir -p etc/ssl/certs
86
 
                            cp /etc/ssl/certs/ca-certificates.crt etc/ssl/certs/
87
 
                    esac
88
 
                fi
89
 
 
 
75
                queue_dir=$(postconf -h queue_directory)
 
76
                cd "$queue_dir"
 
77
 
 
78
                # copy the CA path if specified
 
79
                ca_path=$(postconf -h smtp_tls_CApath)
 
80
                case "$ca_path" in
 
81
                    '') :;; # no ca_path
 
82
                    $queue_dir/*) :;;  # skip stuff already in chroot
 
83
                    *)
 
84
                        if test -d "$ca_path"; then
 
85
                            dest_dir="$queue_dir/${ca_path#/}" new=0
 
86
                            if test -d "$dest_dir"
 
87
                                # write to a new directory ...
 
88
                                then dest_dir="$dest_dir.NEW" && new=1
 
89
                                else mkdir --parent ${dest_dir%/*}
 
90
                            fi
 
91
                            # handle files in subdirectories
 
92
                            find "$ca_path" -print0 | cpio -0pdL "$dest_dir"
 
93
                            if [ "$new" = 1 ]; then
 
94
                                # and replace the old directory
 
95
                                rm -r "${dest_dir%.NEW}"
 
96
                                mv "$dest_dir" "${dest_dir%.NEW}"
 
97
                            fi
 
98
                        fi
 
99
                        ;;
 
100
                esac
 
101
                                    
 
102
                # if there is a CA file, copy it
 
103
                ca_file=$(postconf -h smtp_tls_CAfile)
 
104
                case "$ca_file" in
 
105
                    $queue_dir/*) :;;  # skip stuff already in chroot
 
106
                    '') # no ca_file
 
107
                        # or copy the bundle to preserve functionality
 
108
                        ca_bundle=/etc/ssl/certs/ca-certificates.crt
 
109
                        if [ -f $ca_bundle ]; then
 
110
                            mkdir --parent ${ca_bundle%/*}
 
111
                            cp -L "$ca_bundle" "$queue_dir/${ca_bundle%/*}"
 
112
                        fi
 
113
                        ;;
 
114
                    *)
 
115
                        if test -f "$ca_file"; then
 
116
                            dest_dir="$queue_dir/${ca_path#/}"
 
117
                            mkdir --parent "$dest_dir"
 
118
                            cp -L "$ca_file" "$dest_dir"
 
119
                        fi
 
120
                        ;;
 
121
                esac
 
122
                                
90
123
                # if we're using unix:passwd.byname, then we need to add etc/passwd.
91
124
                local_maps=$(postconf -h local_recipient_maps)
92
125
                if [ "X$local_maps" != "X${local_maps#*unix:passwd.byname}" ]; then
163
196
    ;;
164
197
 
165
198
    *)
166
 
        log_action_msg "Usage: /etc/init.d/postfix {start|stop|restart|reload|flush|check|abort|force-reload}"
 
199
        log_action_msg "Usage: /etc/init.d/postfix {start|stop|restart|reload|flush|check|abort|force-reload|status}"
167
200
        exit 1
168
201
    ;;
169
202
esac