Line 156:
Line 156:
More examples to be added to this section
More examples to be added to this section
+
+
===Quick steps & tips===
+
+
From http://forums.contribs.org/index.php/topic,45855.0.html
+
+
In order to override a SME template, the filename in .../templates-custom/... should to be identical to the filename in .../templates/....
+
+
Here's how to go about creating a custom template:
+
+
1) Identify the service performing the task I want to customize
+
+
2) Identify the configuration file that needs to be customized
+
+
3) Change the config file manually
+
+
4) Restart the affected service
+
+
5) Verify that restarting the service did not return the config file to the original configuration (dnscache, for example, regenerates .../dnscache/root/servers each time the service is restarted)
+
+
6) Verify that the change introduced, fixes the problem I am addressing
+
+
7) Locate the default template fragment that generates the piece of the config file I want to modify
+
+
8) Copy the default template fragment into the appropriate .../templates-custom/... folder tree
+
+
9) Edit the .../templates-custom/... copy of the template fragment
+
+
10) Use expand-template to regenerate the target config file
+
+
11) Verify (using file date and time, or by using a slightly different value for the new parameter than was used in step 3) that the config file now contains the output generated by the new custom template fragement.
+
+
12) Re-test
+
+
13) Document the operation in the wiki if it seems to me that the info would be useful to others
+
+
Not every config option of every program is templated; for example, there is no template (that I can find) to control /var/service/qpsmtpd/config.
+
+
Not every template is in the location you might expect (.../qpsmtpd/peers/0 is built using the template fragments in .../qpsmtpd/config/plugins due to the instructions in .../templates.metadata/...).
+
+
Not every function is controlled by only one template (or config file) - email attachment size, for example, is affected by settings in qmail, qpsmtpd, php and clamd.
+
+
Finally, template fragments are processed alpha-numerically - so be sure that your customizations are inserted into the target config file in a sensible location.
===References===
===References===