This file is indexed.

config is in exim4-config 4.82-3ubuntu2.4.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
#!/bin/sh
set -e

alias stripwhitespace="sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//'"

installeddebconfversion="$(dpkg -s debconf | sed -ne '/^Version/s/^Version: //p')"
if [ "reconfigure" != "$1" ] && \
	dpkg --compare-versions "${installeddebconfversion}" "le" "1.4" && \
	[ "$exim4postinstisrunning" != "true" ] ; then
	echo "exim4-config.postinst: [WARN] Installed debconf version is broken. Aborting preconfigure." 1>&2
	exit 0
fi

. /usr/share/debconf/confmodule

if [ -n "$EX4DEBUG" ]; then
  echo "now debugging $0 $@"
  set -x
fi

UE4CC="/etc/exim4/update-exim4.conf.conf"

convert_to_long ()
{
	case "$1" in
	internet)
		echo -n "internet site; mail is sent and received directly using SMTP"
		;;
	smarthost)
		echo -n "mail sent by smarthost; received via SMTP or fetchmail"
		;;
	satellite)
		echo -n "mail sent by smarthost; no local mail"
		;;
	local)
		echo -n "local delivery only; not on a network"
		;;
	none)
		echo -n "no configuration at this time"
		;;
	esac
}
convert_to_short ()
{
	case "$1" in
	"internet site; mail is sent and received directly using SMTP")
		echo -n "internet"
		;;
	"mail sent by smarthost; received via SMTP or fetchmail")
		echo -n	"smarthost"
		;;
	"mail sent by smarthost; no local mail")
		echo -n	"satellite"
		;;
	"local delivery only; not on a network")
		echo -n	"local"
		;;
	"no configuration at this time")
		echo -n	"none"
		;;
	esac
}

convert_transport_to_long ()
{
	case "$1" in
	maildir_home)
		echo -n "Maildir format in home directory"
		;;
	mail_spool)
		echo -n "mbox format in /var/mail/"
		;;
	*)
		echo -n "locally customized"
		;;
	esac
}
convert_transport_to_short ()
{
	case "$1" in
	"Maildir format in home directory")
		echo -n "maildir_home"
		;;
	"mbox format in /var/mail/")
		echo -n "mail_spool"
		;;
	*)
		echo -n "custom"
		;;
	esac
}

# store environment variables in debconf db.
storevar2db() {
	dc_eximconfig_configtype="$(printf '%s\n' "${dc_eximconfig_configtype}" | stripwhitespace)"
	dc_local_interfaces="$(printf '%s\n' "${dc_local_interfaces}" | stripwhitespace)"
	dc_other_hostnames="$(printf '%s\n' "${dc_other_hostnames}" | stripwhitespace)"
	dc_readhost="$(printf '%s\n' "${dc_readhost}" | stripwhitespace)"
	dc_relay_domains="$(printf '%s\n' "${dc_relay_domains}" | stripwhitespace)"
	dc_relay_nets="$(printf '%s\n' "${dc_relay_nets}" | stripwhitespace)"
	dc_smarthost="$(printf '%s\n' "${dc_smarthost}" | stripwhitespace)"
	dc_minimaldns="$(printf '%s\n' "${dc_minimaldns}" | stripwhitespace)"
	dc_use_split_config="$(printf '%s\n' "${dc_use_split_config}" | stripwhitespace)"
	dc_hide_mailname="$(printf '%s\n' "${dc_hide_mailname}" | stripwhitespace)"
	# store externally changed values to debconf.db
	db_set exim4/dc_eximconfig_configtype \
		"$(convert_to_long ${dc_eximconfig_configtype})"
	db_set exim4/dc_local_interfaces "${dc_local_interfaces}"
	db_set exim4/dc_other_hostnames "${dc_other_hostnames}"
	db_set exim4/dc_readhost "${dc_readhost}"
	db_set exim4/dc_relay_domains "${dc_relay_domains}"
	db_set exim4/dc_relay_nets "${dc_relay_nets}"
	db_set exim4/dc_smarthost "${dc_smarthost}"
	if [ "${dc_minimaldns}" != "" ]; then
		db_set exim4/dc_minimaldns "${dc_minimaldns}"
	fi
	db_set exim4/use_split_config "${dc_use_split_config}"
	db_set exim4/hide_mailname "${dc_hide_mailname}"
	# do not store "locally customized" in debconf db, otherwise simply
	# removing the custom dc_localdelivery from ue4cc won't work.
	if [ "${dc_localdelivery}" != "" ] &&
		[ "$(convert_transport_to_long ${dc_localdelivery})" != "locally customized" ] ; then
		db_set exim4/dc_localdelivery \
			"$(convert_transport_to_long ${dc_localdelivery})"
	fi
	db_fset "exim4/dc_other_hostnames" mailname "${dc_mailname_in_oh}"
}

# ipv6: replace double colons in colon-separated host lists with umlaut-o
# replace ':' with ' : ', add leading and ending whitespace.
# return empty string if custom delimiter was used:
	#    local_domains = <; 172.16.0.0/12; 3ffe:ffff:836f::/48
# e.g: 'localhost : 172.16.0.1 :3ffe::ffff::836f::::: foo.org'
#       ===> ' localhost : 172.16.0.1 : 3ffe�ffff�836f�� : foo.org '
alias coloncolon2oe="env -u LC_ALL LC_CTYPE=C sed -e 's/[[:blank:]]*//g' -e '/^</d' -e 's/:::::/:��/g' -e 's/::::/��/g' -e 's/:::/:�/g' -e 's/::/�/g' -e 's/:/ : /g' -e 's/^/ /' -e 's/$/ /'"

# try to parse exim3 configuration file - works only if it was generated
# with eximconfig.
parseexim3() {
	dc_mailname="$(head -n 1 /etc/mailname | stripwhitespace)" || true

	# get the .... entries from
	# host_accept_relay = 127.0.0.1 : ::::1 : ......
	# if they exist, ie. parse list, and remove "127.0.0.1", "::::1"
	# and "localhost" from it.
	#
	dc_relay_nets="$(cat $1 | grep -h '^host_accept_relay[[:blank:]]*=' | sed -e 's/^host_accept_relay[[:blank:]]*=//' | coloncolon2oe | env -u LC_ALL LC_CTYPE=C sed -e 's/ 127\.0\.0\\.1 //g' -e 's/ localhost //g' -e 's/ ��1//g' -e 's/[[:blank:]]*//g' -e 's/::/:/g' -e 's/^://' -e 's/:$//' -e 's/�/::/g')"

	# 'local_domains = $colonhostnames', including mailname and "localhost"
	#
	dc_other_hostnames="$(cat $1 | grep -h '^local_domains[[:blank:]]*=' | sed -e 's/^local_domains[[:blank:]]*=//' | coloncolon2oe | env -u LC_ALL LC_CTYPE=C sed -e 's/ localhost //g' -e "s/ ${dc_mailname} //g" -e 's/[[:blank:]]*//g' -e 's/::/:/g' -e 's/^://' -e 's/:$//' -e 's/�/::/g')"

	# relay_domains = some.domain
	dc_relay_domains="$(cat $1 | grep -h '^relay_domains = ' | sed -e 's/^relay_domains[[:blank:]]*=[[:blank:]]*//' -e 's/[[:blank:]]*$//')"

	# lookuphost router exist ---> dc_eximconfig_configtype=internet
	#
	if cat $1 | grep -h -A2 '^lookuphost:' | \
		grep -h -A1 '[[:blank:]]*driver = lookuphost' | \
		grep -h -q '[[:blank:]]*transport = remote_smtp' ; then
		dc_eximconfig_configtype=internet
	else
		# smart:-director exists ---> dc_eximconfig_configtype=satellite
		#
		# Later we need the new_address directive to find dc_readhost.
		# ' || true' is required for "set -e"
		dc_readhost="$(cat $1 | grep -h -A2 '^smart:' | grep -h -A1 '^[[:blank:]]*driver = smartuser' | grep -h '^[[:blank:]]*new_address' || true)"

		# smarthost router exists --> dc_eximconfig_configtype is satellite or smarthost
		#
		# we need the route_list directive to find dc_smarthost
		# ' || true' is required for "set -e"
		dc_smarthost="$(< $1 grep -A3 '^smarthost:' | grep -A2 '[[:blank:]]*driver = domainlist' | grep -A1 '^[[:blank:]]*transport = remote_smtp' | grep '^[[:blank:]]*route_list = ".*"' || true)"

		if [ ! -z "${dc_readhost}" ] ; then
			dc_eximconfig_configtype=satellite
		elif [ ! -z "${dc_smarthost}" ] ; then
			dc_eximconfig_configtype=smarthost
		elif ! cat "$1" | grep -h -q '^remote_smtp:'; then
			# dc_eximconfig_configtype=local has no remote_smtp transport.
			dc_eximconfig_configtype=local
		else
			# handcrafted config. We probably misparsed, reset values
			# and exit.
			dc_eximconfig_configtype=''
			dc_local_interfaces='notset'
			dc_other_hostnames=''
			dc_readhost=''
			dc_relay_domains=''
			dc_relay_nets=''
			dc_smarthost=''
			dc_hide_mailname=''
			return 1
		fi
	fi

	case ${dc_eximconfig_configtype} in
		internet|local)
			#paranoia
			dc_readhost=''
			dc_smarthost=''
			dc_hide_mailname='false'
			;;
		satellite)
			#  new_address = ${local_part}@$readhost
			dc_readhost="$(printf '%s\n' "${dc_readhost}" | sed -e 's/^.*@//' -e 's/[[:blank:]]*$//')"
			#  route_list = "* $smtphost bydns_a"
			dc_smarthost="$(printf '%s\n' "${dc_smarthost}" | \
				sed -e 's/^ *route_list = "\* //' -e 's/ bydns_a"//' -e 's/[[:blank:]]*$//')"
			dc_hide_mailname='true'
			dc_relay_domains=''
			;;
		smarthost)
			#  route_list = "* $smtphost bydns_a"
			dc_smarthost="$(printf '%s\n' "${dc_smarthost}" | \
				sed -e 's/^ *route_list = "\* //' -e 's/ bydns_a"//' -e 's/[[:blank:]]*$//')"
			dc_hide_mailname='false'
			dc_relay_domains=''
			;;
	esac
}

##########
mailname2otherhostnames() {
	# u-ex4.conf no longer includes mailname in local domains,
	# insert it once into other_hostnames.
	# The debconf script might run twice, we need to store the result
	# in a file to pass it to postinst..
	[ -d /var/lib/exim4 ] || \
		install -d -oroot -groot -m755 /var/lib/exim4
	dc_mailname="$(head -n 1 /etc/mailname | stripwhitespace)" || true
	if [ -z "${dc_other_hostnames}" ] ; then
		dc_other_hostnames="${dc_mailname}"
	else
		dc_other_hostnames="$(printf '%s\n' "${dc_other_hostnames}" | stripwhitespace)":${dc_mailname}
	fi
	printf '%s\n' dc_other_hostnames="'""${dc_other_hostnames}""'" > \
		/var/lib/exim4/addmailname2oh
	db_fset "exim4/dc_other_hostnames" mailname true
	dc_mailname_in_oh="true"
}
mailname2otherhostnamesdcloop() {
# append mailname to other_hostnames, once. on fresh installations.
	if [ "${dc_mailname_in_oh}" != "true" ] ;then
		db_get exim4/mailname
		dc_mailname="$(printf '%s\n' "$RET"| stripwhitespace)"
		db_get "exim4/dc_other_hostnames"
		dc_other_hostnames="$(printf '%s\n' "$RET"| stripwhitespace)"
		if [ -z "${dc_other_hostnames}" ] ; then
			dc_other_hostnames="${dc_mailname}"
		else
			dc_other_hostnames="${dc_other_hostnames}:${dc_mailname}"
		fi
		db_set exim4/dc_other_hostnames "${dc_other_hostnames}"
		db_fset "exim4/dc_other_hostnames" mailname true
		dc_mailname_in_oh="true"
	fi
}
##########


# set to dummy value, so we can differ between unset vs (seen or set outside debconf)
dc_local_interfaces=notset

db_settitle exim4/exim4-config-title 
db_get exim4/dc_eximconfig_configtype
dc_eximconfig_configtype="$(convert_to_short "$RET")"
db_get exim4/use_split_config
dc_use_split_config="$RET"
# Did we append mailname to other_hostnames yet?
db_fget "exim4/dc_other_hostnames" mailname || true
dc_mailname_in_oh="$RET"

if [ -e $UE4CC ] ; then
	. $UE4CC || true
	# on upgrades _once_ add mailname to other_hostnames
	if [ -n "$2" ] && [ "$1" = "configure" ] && \
		[ "${dc_mailname_in_oh}" != "true" ] ; then
			mailname2otherhostnames
	fi
	# set defaults using these values
	storevar2db
else
	# If there are no debconf answers (running first time) and we are
	# making a cross upgrade from exim3, try to parse its config file
	# to seed debconf db.
	if [ "${dc_eximconfig_configtype}" = "" ] && [ -r /etc/exim/exim.conf ] ; then
		# parse old configfile
		#
		# first do unfolding of lines continued with backslash, by:
		# 1. remove comment lines
		# 2. remove blank lines
		# 3. remove "\<optional space><newline><optional space>"
		exim3confunfolded="$(tempfile -p EX3)"
		perl -e \
		'undef $/;
		while (<>) {
			s/^[[:space:]]*#[^\n]*\n//mg;
			s/^\n//mg;
			s/\\[[:space:]]*\n[[:space:]]*//g;
		} continue {
			print or die "blah";
		}' < /etc/exim/exim.conf > "$exim3confunfolded"
		if parseexim3 "$exim3confunfolded" ; then
			# set defaults using these values
			storevar2db
		fi
		rm -f "$exim3confunfolded"
	fi
fi

## set up default values, we cannot do this in templates file because
## config script is called two times before update-exim4.conf.conf exists.
[ "${dc_eximconfig_configtype}" = "" ] && \
	dc_eximconfig_configtype="local" && \
	db_set exim4/dc_eximconfig_configtype "$(convert_to_long ${dc_eximconfig_configtype})"


if [ -e /etc/mailname ] ; then
	dc_mailname="$(head -n 1 /etc/mailname | stripwhitespace)" || true
	# store values
	db_set exim4/mailname "${dc_mailname}"
else
	db_get exim4/mailname
	dc_mailname="$RET"
fi

#Set default mailname
if [ "${dc_mailname}" = "" ] ; then
	dc_mailname="$(hostname --fqdn 2>/dev/null)" || dc_mailname="$(hostname)" && \
	dc_mailname="$(printf '%s\n' "${dc_mailname}" | stripwhitespace)" && \
	db_set exim4/mailname "${dc_mailname}"
fi
fqdn="$(hostname --fqdn 2>/dev/null)" || fqdn=''
db_subst exim4/dc_other_hostnames fqdn "$fqdn"

# initialize env-vars from debconf_db, if they haven't been set yet either by
# parseexim3() or by sourcing $UE4CC
if [ "${dc_readhost}" = "" ] ; then
	db_get exim4/dc_readhost
	dc_readhost="$RET"
fi
if [ "${dc_smarthost}" = "" ] ; then
	db_get exim4/dc_smarthost
	dc_smarthost="$RET"
fi
# Tricky! An empty value for this option is significant, therefore both
# envvar and debconf-value default to "nonset"  instead of "", the
# following line will only change then envvars value if the config-script
# runs the second time without existing $UE4CC or
# if the debconf-db has been preseeded by other means.
if [ "${dc_local_interfaces}" = "notset" ]; then
	db_get exim4/dc_local_interfaces
	dc_local_interfaces="$RET"
fi
if [ "${dc_minimaldns}" = "" ] ; then
	db_get exim4/dc_minimaldns
	dc_minimaldns="$RET"
fi

if [ "${dc_use_split_config}" = "" ] ; then
	if [ "${2}" = "" ] ; then
		# fresh installation
		db_set exim4/use_split_config false
		dc_use_split_config="false"
	else
		db_set exim4/use_split_config true
		dc_use_split_config="true"
	fi
fi

if [ "${dc_localdelivery}" = "" ] ; then
	db_get exim4/dc_localdelivery
	dc_localdelivery="$(convert_transport_to_short "$RET")"
elif [ "$(convert_transport_to_long ${dc_localdelivery})" = "locally customized" ] ; then
	dc_localdelivery="custom"
fi

db_version 2.0

db_capb backup
# initial state
STATE=1
# state to continue for all values
CONTSTATE=50
# last valid state
STATELIMIT=51
EX4QUESTION=""
while [ "$STATE" != 0 ] && [ "$STATE" -le "$STATELIMIT" ]; do
	case "$STATE" in
		1)
		# this is now empty
		EX4QUESTION=""
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		;;

		2)
		EX4QUESTION="exim4/dc_eximconfig_configtype"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		CONFIGTYPEQUESTION=2
		db_input medium "$EX4QUESTION" || true
		;;
		3)
		EX4QUESTION=""
		db_get exim4/dc_eximconfig_configtype
		dc_eximconfig_configtype="$(convert_to_short "$RET")"
		BACKSTATE=$(($STATE - 1))
		case "${dc_eximconfig_configtype}" in
			none)
			# dont ask more questions
			#FORWSTATE=$(($STATELIMIT + 1))
			FORWSTATE=4
			;;
			internet)
			FORWSTATE=8
			;;
			smarthost)
			FORWSTATE=20
			;;
			satellite)
			FORWSTATE=30
			;;
			local)
			FORWSTATE=40
			;;
			*)
			# Should not happen. Break loop
			FORWSTATE=$(($STATELIMIT + 1))
			;;
		esac
		;;

		4)
		# show additional info for type=none
		EX4QUESTION="exim4/no_config"
		BACKSTATE=$CONFIGTYPEQUESTION
		FORWSTATE=$(($STATE + 1))
		# same priority as configtype because of danger of loop?
		db_input medium "$EX4QUESTION" || true
		;;
		5)
		EX4QUESTION=""
		BACKSTATE=$CONFIGTYPEQUESTION
		db_get exim4/no_config || true
		if [ "$RET" = "false" ]; then
			FORWSTATE=$CONFIGTYPEQUESTION
		else
			#break loop
			FORWSTATE=$CONTSTATE
		fi
		;;

		8)
		# internet site
		EX4QUESTION="exim4/mailname"
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$CONFIGTYPEQUESTION
		FORWSTATE=$(($STATE + 1))
		;;
		9)
		EX4QUESTION="exim4/dc_local_interfaces"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		if [ "${dc_local_interfaces}" = "notset" ] ; then
			dc_local_interfaces=''
			db_set exim4/dc_local_interfaces ''
		fi
		db_input medium "$EX4QUESTION" || true
		;;
		10)
		EX4QUESTION="exim4/dc_other_hostnames"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		mailname2otherhostnamesdcloop
		db_input medium "$EX4QUESTION" || true
		;;
		11)
		EX4QUESTION="exim4/dc_relay_domains"
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		;;
		12)
		EX4QUESTION="exim4/dc_relay_nets"
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		;;
		13)
		EX4QUESTION="exim4/dc_minimaldns"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_input low "$EX4QUESTION" || true
		;;
		14)
		EX4QUESTION="exim4/dc_localdelivery"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$CONTSTATE
		# do not ask question if user has set a different transport 
		# than maildir or mailspool
		if [ "${dc_localdelivery}" != "custom" ] ; then
			db_input low "$EX4QUESTION" || true
		fi
		;;

		
		20)
		# internet site with smarthost
		EX4QUESTION="exim4/mailname"
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$CONFIGTYPEQUESTION
		FORWSTATE=$(($STATE + 1))
		;;
		21)
		EX4QUESTION="exim4/dc_local_interfaces"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		if [ "${dc_local_interfaces}" = "notset" ] ; then
			dc_local_interfaces='127.0.0.1 ; ::1'
			db_set exim4/dc_local_interfaces '127.0.0.1 ; ::1'
		fi
		db_input medium "$EX4QUESTION" || true
		;;
		22)
		EX4QUESTION="exim4/dc_other_hostnames"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		mailname2otherhostnamesdcloop
		db_input medium "$EX4QUESTION" || true
		;;
		23)
		EX4QUESTION="exim4/dc_relay_domains"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_get "$EX4QUESTION" || true
		dc_relay_domains="$RET"
		# Only ask for relay domains if non-empty, since this only
		# really works for internet site hosts. (See comment near
		# smarthost router definition in configuration file.)
		if [ "${dc_relay_domains}" != "" ] ; then
			db_input medium "$EX4QUESTION" || true
		fi
		;;
		24)
		EX4QUESTION="exim4/dc_relay_nets"
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		;;
		25)
		EX4QUESTION="exim4/dc_smarthost"
		if [ "${dc_smarthost}" = "" ] ; then
			# default to mail.mailname
			dc_smarthost="mail.${dc_mailname}"
			db_set exim4/dc_smarthost "${dc_smarthost}"
		fi
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		;;
		26)
		EX4QUESTION="exim4/hide_mailname"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_get exim4/mailname || true
		dc_mailname="$RET"
		db_get exim4/dc_other_hostnames || true
		dc_other_hostnames="$RET"
		db_subst exim4/hide_mailname mailname ${dc_mailname}
		db_subst exim4/hide_mailname dc_other_hostnames \
			${dc_other_hostnames}
               db_get $EX4QUESTION || true
               dc_hide_mailname="$RET"
		if [ "${dc_hide_mailname}" = "" ] ; then
			dc_hide_mailname='false'
			db_set exim4/hide_mailname "${dc_hide_mailname}"
		fi
		db_input medium "$EX4QUESTION" || true
		;;
		27)
		EX4QUESTION="exim4/dc_readhost"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_get exim4/hide_mailname
		dc_hide_mailname="$RET"
		if [ "${dc_hide_mailname}" = "true" ];then
			if [ "${dc_readhost}" = "" ] ; then
				# default to mailname
				dc_readhost="${dc_mailname}"
				db_set exim4/dc_readhost "${dc_readhost}"
			fi
			db_input medium "$EX4QUESTION" || true
		else
			EX4QUESTION=""
		fi
		;;
		28)
		EX4QUESTION="exim4/dc_minimaldns"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_input low "$EX4QUESTION" || true
		;;
		29)
		EX4QUESTION="exim4/dc_localdelivery"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$CONTSTATE
		# do not ask question if user has set a different transport 
		# than maildir or mailspool
		if [ "${dc_localdelivery}" != "custom" ] ; then
			db_input low "$EX4QUESTION" || true
		fi
		;;
		
		30)
		# satellite
		EX4QUESTION="exim4/mailname"
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$CONFIGTYPEQUESTION
		FORWSTATE=$(($STATE + 1))
		;;
		31)
		EX4QUESTION="exim4/dc_local_interfaces"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		if [ "${dc_local_interfaces}" = "notset" ] ; then
			dc_local_interfaces='127.0.0.1 ; ::1'
			db_set exim4/dc_local_interfaces '127.0.0.1 ; ::1'
		fi
		db_input medium "$EX4QUESTION" || true
		;;
		32)
		EX4QUESTION="exim4/dc_other_hostnames"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		mailname2otherhostnamesdcloop
		db_input medium "$EX4QUESTION" || true
		;;
		33)
		EX4QUESTION="exim4/dc_readhost"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		# satellite requires a mail-hub, no use asking whether there
		# is one.
		db_set exim4/hide_mailname "true"
		dc_hide_mailname="true"
		if [ "${dc_readhost}" = "" ] ; then
			# default to domain of mailname
			dc_readhost="${dc_mailname}"
			db_set exim4/dc_readhost "${dc_readhost}"
		fi
		db_input medium "$EX4QUESTION" || true
		;;
		34)
		EX4QUESTION="exim4/dc_smarthost"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_get exim4/dc_readhost
		dc_readhost="$RET"
		if [ "${dc_smarthost}" = "" ] ; then
			# default to read_host
			dc_smarthost="${dc_readhost}"
			db_set exim4/dc_smarthost "${dc_smarthost}"
		fi
		db_input medium "$EX4QUESTION" || true
		;;
		35)
		EX4QUESTION="exim4/dc_relay_domains"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_get "$EX4QUESTION" || true
		dc_relay_domains="$RET"
		# Only ask for relay domains if non-empty, since this only
		# really works for internet site hosts. (See comment near
		# smarthost router definition in configuration file.)
		if [ "${dc_relay_domains}" != "" ] ; then
			db_input medium "$EX4QUESTION" || true
		fi
		;;
		36)
		EX4QUESTION=""
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		# satellite-system! Only ask for relay_nets if they are
		# nonempty - we cannot distinguish whether they were set outside debconf
		# or whether the user switched dc_eximconfig_configtype
		db_get exim4/dc_relay_nets || true
		dc_relay_nets="$RET"
		if [ "${dc_relay_nets}" != "" ] ; then
			db_input medium exim4/dc_relay_nets || true
			FORWSTATE=$(($STATE + 1))
		fi
		;;	
		37)
		EX4QUESTION="exim4/dc_minimaldns"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_input low "$EX4QUESTION" || true
		;;
		38)
		EX4QUESTION="exim4/dc_localdelivery"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$CONTSTATE
		# Only ask question if it is set to a value that is both supported
		# by debconf (maildir_home and mail_spool) and is not set to the
		# default value (maildir_home) since this is only used for
		# real-*.
		if [ "${dc_localdelivery}" = "maildir_home" ] ; then
			db_input low "$EX4QUESTION" || true
		fi
		;;
		
		40)
		# local mail only
		EX4QUESTION="exim4/mailname"
		db_input medium "$EX4QUESTION" || true
		BACKSTATE=$CONFIGTYPEQUESTION
		FORWSTATE=$(($STATE + 1))
		;;
		41)
		EX4QUESTION=""
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		if [ "${dc_local_interfaces}" = "notset" ] ; then
			dc_local_interfaces='127.0.0.1 ; ::1'
			db_set exim4/dc_local_interfaces '127.0.0.1 ; ::1'
		fi
		db_input medium exim4/dc_local_interfaces || true
		;;

		42)
		EX4QUESTION="exim4/dc_other_hostnames"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		mailname2otherhostnamesdcloop
		db_input medium "$EX4QUESTION" || true
		;;
		
		43)
		EX4QUESTION=""
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		# local mail only -system! Only ask for relay_nets/relay_domains if they are
		# nonempty - we cannot distinguish whether they were set outside debconf
		# or whether the user switched dc_eximconfig_configtype
		db_get exim4/dc_relay_nets || true
		dc_relay_nets="$RET"
		db_get exim4/dc_relay_domains || true
		dc_relay_domains="$RET"
		
		if [ "${dc_relay_nets}" != "" ] ; then
			db_input medium exim4/dc_relay_nets || true
		fi
		if [ "${dc_relay_domains}" != "" ] ; then
			db_input medium exim4/dc_relay_domains || true
		fi
		;;	
		44)
		EX4QUESTION="exim4/dc_minimaldns"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$(($STATE + 1))
		db_input low "$EX4QUESTION" || true
		;;
		45)
		EX4QUESTION="exim4/dc_localdelivery"
		BACKSTATE=$(($STATE - 1))
		FORWSTATE=$CONTSTATE
		# do not ask question if user has set a different transport 
		# than maildir or mailspool
		if [ "${dc_localdelivery}" != "custom" ] ; then
			db_input low "$EX4QUESTION" || true
		fi
		;;
		50)
		EX4QUESTION="exim4/use_split_config"
		BACKSTATE=$PREVSTATE
		FORWSTATE=$(($STATELIMIT + 1))
		db_input medium "$EX4QUESTION" || true
		;;
	esac
	PREVSTATE=$STATE
	if db_go; then
		STATE=$FORWSTATE
	else
		STATE=$BACKSTATE
	fi
done
if  [ "$STATE" = 0 ] ; then
	# User pressed back on the first question, go back to previous
	# package if run by base-config 2.0. #222773.
	exit 30
fi

# make sure dc_local_interfaces is set to sane value
if [ "${dc_local_interfaces}" = "notset" ] ; then
	dc_local_interfaces=''
	db_set exim4/dc_local_interfaces ''
fi

if [ ! -e /etc/aliases ] || \
	! grep -q '^root:[[:space:]]*[[:alnum:]]' /etc/aliases ; then
	db_get exim4/dc_postmaster
	if [ -z "$RET" ] && db_get passwd/username; then
		db_set exim4/dc_postmaster "${RET}"
	fi
	db_input medium exim4/dc_postmaster || true
	db_go || true
fi

db_get exim4/dc_postmaster || true
dc_postmaster="$(printf '%s\n' "$RET" | stripwhitespace)"

# this has been commented out for a long time, remove by the end of 2007
# if [ "${dc_eximconfig_configtype}" = "satellite" ] || [ "${dc_eximconfig_configtype}" = "local" ] ; then
# 	# reset dc_relay_domains dc_relay_nets and dc_other_hostnames
# 	db_set exim4/dc_relay_domains ""
# 	db_set exim4/dc_relay_nets ""
# 	db_set exim4/dc_other_hostnames ""
# fi