Hello ;
Since several days, I can read some threads that talk about the ways to customize default services configuration as provided by i-MSCP, and how prevent the installer to remove these customizations. Today again, I've received a mail from an user that asked me a way to achieve such thing.
In all of the threads, I can read things like this:
- If you want customize i-MSCP, you must edit the templates under /etc/imscp...
- If you want keep your changes after update, you must first backup your custom templates, update i-MSCP, restore your custom templates and then, run the imscp-setup script...
...
All these methods are not really the way to go with i-MSCP version >= 1.1.0-rc1.4.
I'll so give you a little example that explain how customize services default configuration without having to modify any template. This example also show the power of i-MSCP.
For this example, let's imagine we want modify the Postfix configuration to allow it to relay mail of any machine that is part of our VPN (Virtual Private Network). We can do such thing using hooks.
To do so, We must create a little perl script in which we will define hook functions that will act on some events during install process:
File /root/imscp_custom.pl
instead of
- # perl imscp-autoinstall -d
or, if you want only run the imscp-setup script:
- # cd /var/www/imscp/engine/setup# perl imscp-setup -dh /root/imscp_custom.pl
instead of
- # cd /var/www/imscp/engine/setup
- # perl imscp-setup -dh /root/imscp_custom.pl
That all for now.
Note1: In near future, i'll add a new directory such as /etc/imscp/custom.d in which you will put your hook scripts. Then, the engine (including installer) will be able to run any script present in that directory.
Note2: List of all available hooks will be documented ASAP.
Note3: Take the example above only as an example. It is probably incomplete.
Thank you for using i-MSCP