mbox

[2/2] Core94: fix for dma when postfix is installed

Message ID 1444904308-15139-2-git-send-email-alexander.marx@ipfire.org
State Accepted
Commit ee97ade8e40ece29913a2bd5af59cf94fe4941b1
Headers

Message

Alexander Marx Oct. 15, 2015, 9:18 p.m. UTC
  ---
 config/rootfiles/core/94/update.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Michael Tremer Oct. 15, 2015, 9:59 p.m. UTC | #1
Hi,

the sed command is a bit messy. You can also use a difference character
as a delimiter for the two fields like @. That would look like this:

  sed -e "s@usr/bin/sendmail@usr/bin/sendmail.postfix@g" ...

That makes it more readable.

You can also use the & character in the second half to get the matched
string from the first half. That would look like this:

  sed -e "s@usr/bin/sendmail@&.postfix@" ...

...which is even shorter.

I will merge this because you version is working, too.

-Michael

On Thu, 2015-10-15 at 12:18 +0200, Alexander Marx wrote:
> ---
>  config/rootfiles/core/94/update.sh | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/config/rootfiles/core/94/update.sh
> b/config/rootfiles/core/94/update.sh
> index 1b9eed7..7b645e9 100644
> --- a/config/rootfiles/core/94/update.sh
> +++ b/config/rootfiles/core/94/update.sh
> @@ -70,7 +70,13 @@ EOF
>  
>  fcrontab -z &>/dev/null
>  
> -# dma files
> +# DMA - reconfigure Postfix if exists
> +if [ -e /etc/postfix/main.cf ]; then
> +	mv /usr/sbin/sendmail /usr/sbin/sendmail.postfix
> +	/usr/sbin/alternatives --install /usr/sbin/sendmail sendmail
> /usr/sbin/sendmail.postfix 15
> +	sed -i 's/usr\/sbin\/sendmail/usr/sbin/sendmail.postfix/'
> /opt/pakfire/db/rootfiles/postfix
> +fi
> +# DMA - configure dma as default mta
>  mkdir /etc/alternatives
>  mkdir /var/lib/alternatives
>  /usr/sbin/alternatives --install /usr/sbin/sendmail sendmail
> /usr/sbin/sendmail.dma 20