Import Debian changes 4.92-8+deb10u3
[hcoop/debian/exim4.git] / debian / exim4-config.config
CommitLineData
de45f55a
AM
1#!/bin/sh
2set -e
3
4alias stripwhitespace="sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//'"
5
6installeddebconfversion="$(dpkg -s debconf | sed -ne '/^Version/s/^Version: //p')"
7if [ "reconfigure" != "$1" ] && \
8 dpkg --compare-versions "${installeddebconfversion}" "le" "1.4" && \
9 [ "$exim4postinstisrunning" != "true" ] ; then
10 echo "exim4-config.postinst: [WARN] Installed debconf version is broken. Aborting preconfigure." 1>&2
11 exit 0
12fi
13
14. /usr/share/debconf/confmodule
15
16if [ -n "$EX4DEBUG" ]; then
17 echo "now debugging $0 $@"
18 set -x
19fi
20
21UE4CC="/etc/exim4/update-exim4.conf.conf"
22
23convert_to_long ()
24{
25 case "$1" in
26 internet)
27 echo -n "internet site; mail is sent and received directly using SMTP"
28 ;;
29 smarthost)
30 echo -n "mail sent by smarthost; received via SMTP or fetchmail"
31 ;;
32 satellite)
33 echo -n "mail sent by smarthost; no local mail"
34 ;;
35 local)
36 echo -n "local delivery only; not on a network"
37 ;;
38 none)
39 echo -n "no configuration at this time"
40 ;;
41 esac
42}
43convert_to_short ()
44{
45 case "$1" in
46 "internet site; mail is sent and received directly using SMTP")
47 echo -n "internet"
48 ;;
49 "mail sent by smarthost; received via SMTP or fetchmail")
50 echo -n "smarthost"
51 ;;
52 "mail sent by smarthost; no local mail")
53 echo -n "satellite"
54 ;;
55 "local delivery only; not on a network")
56 echo -n "local"
57 ;;
58 "no configuration at this time")
59 echo -n "none"
60 ;;
61 esac
62}
63
64convert_transport_to_long ()
65{
66 case "$1" in
67 maildir_home)
68 echo -n "Maildir format in home directory"
69 ;;
70 mail_spool)
71 echo -n "mbox format in /var/mail/"
72 ;;
73 *)
74 echo -n "locally customized"
75 ;;
76 esac
77}
78convert_transport_to_short ()
79{
80 case "$1" in
81 "Maildir format in home directory")
82 echo -n "maildir_home"
83 ;;
84 "mbox format in /var/mail/")
85 echo -n "mail_spool"
86 ;;
87 *)
88 echo -n "custom"
89 ;;
90 esac
91}
92
93# store environment variables in debconf db.
94storevar2db() {
95 dc_eximconfig_configtype="$(printf '%s\n' "${dc_eximconfig_configtype}" | stripwhitespace)"
96 dc_local_interfaces="$(printf '%s\n' "${dc_local_interfaces}" | stripwhitespace)"
97 dc_other_hostnames="$(printf '%s\n' "${dc_other_hostnames}" | stripwhitespace)"
98 dc_readhost="$(printf '%s\n' "${dc_readhost}" | stripwhitespace)"
99 dc_relay_domains="$(printf '%s\n' "${dc_relay_domains}" | stripwhitespace)"
100 dc_relay_nets="$(printf '%s\n' "${dc_relay_nets}" | stripwhitespace)"
101 dc_smarthost="$(printf '%s\n' "${dc_smarthost}" | stripwhitespace)"
102 dc_minimaldns="$(printf '%s\n' "${dc_minimaldns}" | stripwhitespace)"
103 dc_use_split_config="$(printf '%s\n' "${dc_use_split_config}" | stripwhitespace)"
104 dc_hide_mailname="$(printf '%s\n' "${dc_hide_mailname}" | stripwhitespace)"
105 # store externally changed values to debconf.db
106 db_set exim4/dc_eximconfig_configtype \
107 "$(convert_to_long ${dc_eximconfig_configtype})"
108 db_set exim4/dc_local_interfaces "${dc_local_interfaces}"
109 db_set exim4/dc_other_hostnames "${dc_other_hostnames}"
110 db_set exim4/dc_readhost "${dc_readhost}"
111 db_set exim4/dc_relay_domains "${dc_relay_domains}"
112 db_set exim4/dc_relay_nets "${dc_relay_nets}"
113 db_set exim4/dc_smarthost "${dc_smarthost}"
114 if [ "${dc_minimaldns}" != "" ]; then
115 db_set exim4/dc_minimaldns "${dc_minimaldns}"
116 fi
117 db_set exim4/use_split_config "${dc_use_split_config}"
118 db_set exim4/hide_mailname "${dc_hide_mailname}"
119 # do not store "locally customized" in debconf db, otherwise simply
120 # removing the custom dc_localdelivery from ue4cc won't work.
121 if [ "${dc_localdelivery}" != "" ] &&
122 [ "$(convert_transport_to_long ${dc_localdelivery})" != "locally customized" ] ; then
123 db_set exim4/dc_localdelivery \
124 "$(convert_transport_to_long ${dc_localdelivery})"
125 fi
126 db_fset "exim4/dc_other_hostnames" mailname "${dc_mailname_in_oh}"
127}
128
129# ipv6: replace double colons in colon-separated host lists with umlaut-o
130# replace ':' with ' : ', add leading and ending whitespace.
131# return empty string if custom delimiter was used:
132 # local_domains = <; 172.16.0.0/12; 3ffe:ffff:836f::/48
133# e.g: 'localhost : 172.16.0.1 :3ffe::ffff::836f::::: foo.org'
134