How to patch exim.conf with DirectAdmin and custombuild

H

There are some parts in exim.conf that you may need to modify. And they cannot be changed in included files. DirectAdmin will rewrite your changes when updating Exim's configuration file. And here's how you can solve it.

Let's try and modify for an example log_selector In /etc/exim.conf, We are going to add the following features:

+incoming_interface +outgoing_interface +incoming_port +outgoing_port

To make logging more functional with these features.

Let's make a patch for this.

The following commands will create a hook for the custombuild, which will be automatically executed by the script. Run this once as root in the server's console:

mkdir -p /usr/local/directadmin/custombuild/custom/hooks/exim_conf/post/
cd /usr/local/directadmin/custombuild/custom/hooks/exim_conf/post/
touch poralix_patch_exim_conf.sh
chmod 750 poralix_patch_exim_conf.sh
cat > poralix_patch_exim_conf.sh  <<EOF
#!/bin/bash
#----------------------------------------------------------------------
# Description: A script to patch exim.conf
#----------------------------------------------------------------------
# By Poralix // www.poralix.com

echo "Patching log_selector in /etc/exim.conf";
perl -pi -e 's/^log_selector = \\/log_selector = +incoming_interface +outgoing_interface +incoming_port +outgoing_port \\/' /etc/exim.conf;
service exim restart;
EOF

After the command completes you should see a new file:

  • /usr/local/directadmin/custombuild/custom/hooks/exim_conf/post/poralix_patch_exim_conf.sh

This is a patch for exim.conf that will do what we need.

Run the following command as root to apply the patch:

/usr/local/directadmin/custombuild/build exim_conf

exim.conf will be automatically patched whenever you install it with custombuild.

That’s it.

Add comment

By Ranjan