blob: 69c8f87d62e8862eca8c027b9971c27ee1e25958 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_version 2.0
get_value() {
db_get $1
code="$?"
if [ "$code" -eq "0" ]; then
:
else
echo "Error getting debconf answer $1: debconf code=$code" >&2
exit $code
fi
}
write_header() {
cat <<EOF > /etc/exim4/update-exim4.conf.conf
# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# comments will be lost.
EOF
}
writealiases() {
echo '# /etc/aliases' > /etc/aliases.tmp
echo 'mailer-daemon: postmaster' >> /etc/aliases.tmp
for i in postmaster nobody hostmaster usenet news webmaster www ftp abuse noc security ; do
echo "${i}: root"
done >> /etc/aliases.tmp
#poma=`echo "$1" | sed -e 's/^[^A-Za-z.0-9_-]*//' -e 's/[^A-Za-z.0-9_-]*$//' \
# -e 's/ */,/g'`
# remove leading and ending whitespace, shrink multiple whitespace, separate
# entries with commas
poma=`echo "$1" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]]*/,/g'`
if [ "xnone" != "x$poma" ] ; then
echo "root: $poma" >> /etc/aliases.tmp
fi
mv /etc/aliases.tmp /etc/aliases
}
alias stripwhitespace="sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//'"
# REMOVEMEBEFORERELEASE begins
# cruft from renaming debconf.results to update-exim4.conf.conf
if [ -e /etc/exim4/debconf.results ] ; then
if [ ! -e /etc/exim4/update-exim4.conf.conf ]; then
mv /etc/exim4/debconf.results /etc/exim4/update-exim4.conf.conf
else
rm -f /etc/exim4/debconf.results
fi
fi
# REMOVEMEBEFORERELEASE ends
case "$1" in
configure)
# Configure Exim##############################
##############################################
# Generate config-file if it does yet not exist
if [ ! -e /etc/exim4/update-exim4.conf.conf ] ; then
write_header
for variable in dc_eximconfig_configtype dc_other_hostnames \
dc_readhost dc_relay_domains \
dc_relay_nets dc_smarthost ; do
echo "${variable}="
done >> /etc/exim4/update-exim4.conf.conf
fi
# generate dummy files, which will be overwritten by update-exim4.conf
for file in /etc/exim4/conf.d/main/03_exim4-base_neverusers /etc/exim4/conf.d/rewrite/30_exim4-base_email-addresses /etc/exim4/conf.d/rewrite/35_exim4-base_masquerade /etc/exim4/conf.d/router/28_exim4-base_hubuser /etc/exim4/conf.d/router/22_exim4-base_primary ; do
if [ ! -f "$file" ] ; then
echo "# d41d8cd98f00b204e9800998ecf8427e" > "$file"
chmod 644 "$file"
fi
done
# generate defaultfile
update-exim4defaults --init
# Substitute values from debconf db
db_get exim4/dc_eximconfig_configtype || true
dc_eximconfig_configtype=`echo "$RET" | stripwhitespace`
db_get exim4/dc_listenonpublic || true
dc_listenonpublic=`echo "$RET" | stripwhitespace`
db_get exim4/dc_other_hostnames || true
dc_other_hostnames=`echo "$RET" | stripwhitespace`
db_get exim4/dc_readhost || true
dc_readhost=`echo "$RET" | stripwhitespace`
db_get exim4/dc_relay_domains || true
dc_relay_domains=`echo "$RET" | stripwhitespace`
db_get exim4/dc_relay_nets || true
dc_relay_nets=`echo "$RET" | stripwhitespace`
db_get exim4/dc_smarthost || true
dc_smarthost=`echo "$RET" | stripwhitespace`
db_get exim4/mailname || true
mailname=`echo "$RET" | stripwhitespace`
### write configuration to files #
write_header
echo "dc_eximconfig_configtype='${dc_eximconfig_configtype}'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_listenonpublic='${dc_listenonpublic}'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_other_hostnames='${dc_other_hostnames}'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_readhost='${dc_readhost}'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_relay_domains='${dc_relay_domains}'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_relay_nets='${dc_relay_nets}'" >> /etc/exim4/update-exim4.conf.conf
echo "dc_smarthost='${dc_smarthost}'" >> /etc/exim4/update-exim4.conf.conf
echo $mailname > /etc/mailname
### configuration files written ##
db_get exim4/dc_postmaster
dc_postmaster=`echo "$RET" | stripwhitespace`
if [ ! -e /etc/aliases ] ; then
writealiases "${dc_postmaster}"
#check whether /etc/aliases has a entry for root
elif ! grep -q '^root:[[:space:]]*[[:alnum:]]' /etc/aliases && \
[ "x${dc_postmaster}" != "xnone" ]; then
db_get exim4/dc_noalias_regenerate
dc_noalias_regenerate="$RET"
if [ "x${dc_noalias_regenerate}" = "xtrue" ] ; then
mv /etc/aliases /etc/aliases.0
writealiases "${dc_postmaster}"
fi
fi
if [ "${dc_eximconfig_configtype}" != "none" ] ; then
update-exim4.conf
fi
;;
esac
#DEBHELPER#
|