23
cat <<EOF > /etc/exim4/update-exim4.conf.conf
24
# /etc/exim4/update-exim4.conf.conf
26
31
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
27
32
# yourself or use 'dpkg-reconfigure exim4-config'
34
# Please note that this is _not_ a dpkg-conffile and that automatic changes
35
# to this file might happen. The code handling this will honor your local
36
# changes, so this is usually fine, but will break local schemes that mess
37
# around with multiple versions of the file.
39
# update-exim4.conf uses this file to determine variable values to replace
40
# the DEBCONFsomethingDEBCONF strings in the configuration template files.
42
# Most settings found in here do have corresponding questions in the
43
# Debconf configuration, but not all of them.
45
# This is a Debian specific file
184
202
# Configure Exim##############################
185
203
##############################################
186
204
# valid config directives
187
dc_directives="dc_eximconfig_configtype dc_other_hostnames dc_local_interfaces dc_readhost dc_relay_domains dc_minimaldns dc_relay_nets dc_smarthost CFILEMODE dc_use_split_config dc_hide_mailname"
205
dc_directives="dc_eximconfig_configtype dc_other_hostnames dc_local_interfaces dc_readhost dc_relay_domains dc_minimaldns dc_relay_nets dc_smarthost CFILEMODE dc_use_split_config dc_hide_mailname dc_mailname_in_oh"
188
206
# Generate config-file if it does not yet exist
189
if [ ! -e /etc/exim4/update-exim4.conf.conf ] ; then
207
if [ ! -e $UE4CC ] ; then
191
209
for variable in ${dc_directives} ; do
192
210
echo "${variable}="
193
done >> /etc/exim4/update-exim4.conf.conf
196
214
# If this is a fresh installation generate dummy files, which
208
226
# generate defaultfile
209
227
update-exim4defaults --init
211
# source /etc/exim4/update-exim4.conf.conf - needed for not
229
# source $UE4CC - needed for not
212
230
# debconf-managed values in there.
213
. /etc/exim4/update-exim4.conf.conf
215
233
# Substitute values from debconf db
216
234
db_get exim4/dc_eximconfig_configtype || true
217
235
dc_eximconfig_configtype=`convert_to_short "$RET"`
218
236
db_get exim4/dc_local_interfaces || true
219
dc_local_interfaces=`echo "$RET" | stripwhitespace`
237
dc_local_interfaces=`printf '%s\n' "$RET" | stripwhitespace`
220
238
db_get exim4/dc_other_hostnames || true
221
dc_other_hostnames=`echo "$RET" | stripwhitespace`
239
dc_other_hostnames=`printf '%s\n' "$RET" | stripwhitespace`
222
240
db_get exim4/dc_readhost || true
223
dc_readhost=`echo "$RET" | stripwhitespace`
241
dc_readhost=`printf '%s\n' "$RET" | stripwhitespace`
224
242
db_get exim4/dc_relay_domains || true
225
dc_relay_domains=`echo "$RET" | stripwhitespace`
243
dc_relay_domains=`printf '%s\n' "$RET" | stripwhitespace`
226
244
db_get exim4/dc_relay_nets || true
227
dc_relay_nets=`echo "$RET" | stripwhitespace`
245
dc_relay_nets=`printf '%s\n' "$RET" | stripwhitespace`
228
246
db_get exim4/dc_smarthost || true
229
dc_smarthost=`echo "$RET" | stripwhitespace`
247
dc_smarthost=`printf '%s\n' "$RET" | stripwhitespace`
230
248
db_get exim4/dc_minimaldns || true
231
dc_minimaldns=`echo "$RET" | stripwhitespace`
249
dc_minimaldns=`printf '%s\n' "$RET" | stripwhitespace`
232
250
db_get exim4/mailname || true
233
mailname=`echo "$RET" | stripwhitespace`
251
mailname=`printf '%s\n' "$RET" | stripwhitespace`
234
252
db_get exim4/use_split_config || true
235
dc_use_split_config=`echo "$RET" | stripwhitespace`
253
dc_use_split_config=`printf '%s\n' "$RET" | stripwhitespace`
236
254
db_get exim4/hide_mailname || true
237
dc_hide_mailname=`echo "$RET" | stripwhitespace`
255
dc_hide_mailname=`printf '%s\n' "$RET" | stripwhitespace`
256
if [ -r /var/lib/exim4/addmailname2oh ] ; then
257
# .config added mailname to other hostnames, 2nd run of config script
258
# will have overwritten this change in debcond-db, therefore we need
259
# to store this externally, too.
260
. /var/lib/exim4/addmailname2oh
261
rm -f /var/lib/exim4/addmailname2oh
263
db_fget "exim4/dc_other_hostnames" mailname || true
264
dc_mailname_in_oh="$RET"
239
266
[ "x${CFILEMODE}" = "x" ] && CFILEMODE=644
241
268
db_get exim4/dc_postmaster
242
dc_postmaster=`echo "$RET" | stripwhitespace`
269
dc_postmaster=`printf '%s\n' "$RET" | stripwhitespace`
244
271
if [ ! -e /etc/aliases ] ; then
252
279
### write configuration to files #
253
280
# add missing items
254
281
for variable in ${dc_directives} ; do
255
if ! grep -E -q "^[[:space:]]*${variable}=" /etc/exim4/update-exim4.conf.conf ; then
256
echo "${variable}=''" >> /etc/exim4/update-exim4.conf.conf
282
if ! grep -E -q "^[[:space:]]*${variable}=" $UE4CC ; then
283
echo "${variable}=''" >> $UE4CC
259
286
# insert new values, remove outdated ones.
260
sed -e "s�^[[:space:]]*dc_eximconfig_configtype=.*�dc_eximconfig_configtype='${dc_eximconfig_configtype}'�" \
261
-e "s�^[[:space:]]*dc_local_interfaces=.*�dc_local_interfaces='${dc_local_interfaces}'�" \
262
-e "s�^[[:space:]]*dc_other_hostnames=.*�dc_other_hostnames='${dc_other_hostnames}'�" \
263
-e "s�^[[:space:]]*dc_readhost=.*�dc_readhost='${dc_readhost}'�" \
264
-e "s�^[[:space:]]*dc_relay_domains=.*�dc_relay_domains='${dc_relay_domains}'�" \
265
-e "s�^[[:space:]]*dc_relay_nets=.*�dc_relay_nets='${dc_relay_nets}'�" \
266
-e "s�^[[:space:]]*dc_smarthost=.*�dc_smarthost='${dc_smarthost}'�" \
267
-e "s�^[[:space:]]*dc_minimaldns=.*�dc_minimaldns='${dc_minimaldns}'�" \
268
-e "s�^[[:space:]]*CFILEMODE=.*�CFILEMODE='${CFILEMODE}'�" \
269
-e "s�^[[:space:]]*dc_never_users=.*��" \
270
-e "s�^[[:space:]]*dc_use_split_config=.*�dc_use_split_config='${dc_use_split_config}'�" \
271
-e "s�^[[:space:]]*dc_hide_mailname=.*�dc_hide_mailname='${dc_hide_mailname}'�" \
272
< /etc/exim4/update-exim4.conf.conf \
273
> /etc/exim4/update-exim4.conf.conf.tmp
274
mv /etc/exim4/update-exim4.conf.conf.tmp /etc/exim4/update-exim4.conf.conf
288
# Use environment variables to communicate data to awk, to
289
# avoid shell (or awk or sed) string expansion which may
290
# expand escape sequences. Note that the variables named in
291
# ${dc_directives} (but not the variable names themselves) may
292
# contain escaped characters like \N.
294
export dc_directives ${dc_directives}
298
split( ENVIRON["dc_directives"], directives, "[ \t]" );
302
for ( i in directives )
304
regex = "^[ \t]*" directives[i] "=";
305
if ( ( $0 ~ regex ) && ( ! written ) )
307
# Add single quotes (\0x27) around the value.
308
print directives[i] "=\x27" ENVIRON[directives[i]] "\x27";
315
}' < ${UE4CC} > ${UE4CC}.tmp
317
mv ${UE4CC}.tmp $UE4CC
276
319
echo $mailname > /etc/mailname
277
320
### configuration files written ##
281
324
[ "${dc_eximconfig_configtype}" != "exim3manual" ]; then
282
325
update-exim4.conf
327
# If dpkg-reconfigure was used implement the changes by restarting
329
if [ "${DEBCONF_RECONFIGURE}" = "1" ] ; then
330
if [ -x /etc/init.d/exim4 ] && \
331
command -v invoke-rc.d >/dev/null 2>&1; then
332
# use restart instead of reload, as changing listening
333
# interfaces cannot be done with HUP.
335
invoke-rc.d exim4 restart || true