File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -362,8 +362,6 @@ terminate_alias:
362362 transport = devnull
363363 condition = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/aliases}{true}{false}}
364364
365-
366-
367365######################################################################
368366# TRANSPORTS CONFIGURATION #
369367######################################################################
Original file line number Diff line number Diff line change @@ -377,14 +377,13 @@ catchall:
377377 data = ${extract{1}{:}{${lookup{*@$domain}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/aliases}}}}
378378 file_transport = local_delivery
379379 redirect_router = dnslookup
380+ condition = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/aliases}{false}{true}}
380381
381382terminate_alias:
382383 driver = accept
383384 transport = devnull
384385 condition = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/aliases}{true}{false}}
385386
386-
387-
388387######################################################################
389388# TRANSPORTS CONFIGURATION #
390389######################################################################
Original file line number Diff line number Diff line change @@ -364,8 +364,6 @@ terminate_alias:
364364 transport = devnull
365365 condition = ${lookup{$local_part@$domain}lsearch{/etc/exim4/domains/$domain/aliases}{true}{false}}
366366
367-
368-
369367######################################################################
370368# TRANSPORTS CONFIGURATION #
371369######################################################################
Original file line number Diff line number Diff line change @@ -264,4 +264,19 @@ if [ "$MAIL_SYSTEM" = "exim4" ]; then
264264 chown root:Debian-exim /etc/exim4/srs.conf
265265 fi
266266 fi
267+
268+ exim_version=$( exim4 --version | head -1 | awk ' {print $3}' | cut -f -2 -d .)
269+ # if Exim version > 4.95 or greater!
270+ if version_ge " $exim_version " " 4.95" ; then
271+ if [ -z " $( grep -e ' condition = \${lookup{\$local_part@\$domain}lsearch{/etc/exim4/domains/\${lookup{\$domain}dsearch{/etc/exim4/domains/}}/aliases}{false}{true}}' /etc/exim4/exim4.conf.template) " ]; then
272+ for line in $( sed -n ' /redirect_router = dnslookup/=' /etc/exim4/exim4.conf.template) ; do
273+ testline=$(( line - 1 ))
274+ newline=$(( line + 1 ))
275+ if [ " $( awk NR==$testline /etc/exim4/exim4.conf.template) " = " file_transport = local_delivery" ]; then
276+ # Add new line
277+ sed -i " $newline i \ \ condition = \$ {lookup{\$ local_part@\$ domain}lsearch{/etc/exim4/domains/\$ {lookup{\$ domain}dsearch{/etc/exim4/domains/}}/aliases}{false}{true}}" /etc/exim4/exim4.conf.template
278+ fi
279+ done
280+ fi
281+ fi
267282fi
You can’t perform that action at this time.
0 commit comments