Debian Codegraph @

debian/esmtp.postinst

raw
1 #!/bin/sh
2
3 set -e
4
5 #DEBHELPER#
6
7 . /usr/share/debconf/confmodule
8
9 db_get esmtp/overwriteconfig
10 OverwriteConfig="$RET"
11
12 if test -s /etc/esmtprc -a "$OverwriteConfig" = "false"
13 then
14 exit 0
15 fi
16
17 db_get esmtp/hostname
18 HostName="$RET"
19
20 db_get esmtp/hostport
21 HostPort="$RET"
22
23 db_get esmtp/username
24 UserName="$RET"
25
26 db_get esmtp/password
27 Password="$RET"
28
29 db_get esmtp/starttls
30 StartTLS="$RET"
31
32 db_get esmtp/certificate_passphrase
33 CertificatePassphrase="$RET"
34
35 db_get esmtp/mda
36 case "$RET" in
37 procmail)
38 MDA='/usr/bin/procmail -d %T'
39 ;;
40 maildrop)
41 MDA='/usr/bin/maildrop'
42 ;;
43 esac
44
45 exec 1>/etc/esmtprc
46
47 if test "$OverwriteConfig" = "true"
48 then
49 echo "### This file is auto-generated using debconf on install. ###"
50 echo "### Any changes made will be overwritten on next upgrade. ###"
51 echo "#"
52 fi
53 echo "# Config file for ESMTP sendmail"
54 echo
55 echo "# The SMTP host and service (port)"
56 echo "hostname=$HostName:$HostPort"
57 echo
58 echo "# SECURITY WARNING: Do NOT set username and password in the system wide"
59 echo "# configuration file unless you are the only user of this machine. See"
60 echo "# esmtprc(5)."
61 echo
62 echo "# The user name"
63 test -z "$UserName" && echo -n "#"
64 echo "username=$UserName"
65 echo
66 echo "# The password"
67 test -z "$UserName" && echo -n "#"
68 echo "password=$Password"
69 echo
70 echo "# Whether to use Starttls"
71 test "$StartTLS" = "disabled" && echo -n "#"
72 echo "starttls=$StartTLS"
73 echo
74 echo "# The certificate passphrase"
75 test -z "$CertificatePassphrase" && echo -n "#"
76 echo "certificate_passphrase=$CertificatePassphrase"
77 echo
78 echo "# The Mail Delivery Agent"
79 test -z "$MDA" && echo -n "#"
80 echo "mda=\"$MDA\""