I think an approach which would be similar to existing packages would be to use instead something like a ".d" directory. Like this:
- /etc/kamailio/kamailio.cfg: main configuration - /etc/kamailio/kamailio.cfg.d: include files for main configuration
Then you could simply drop include cfg files into this directory and they would be added to the main cfg. But we would need to use also some ordering, as the order in which the cfgs are loaded is important. Existing packages uses something like a number as a prefix. Example:
- /etc/kamailio/kamailio.cfg - /etc/kamailio/kamailio.cfg.d/01-interfaces - /etc/kamailio/kamailio.cfg.d/10-modules - /etc/kamailio/kamailio.cfg.d/50-custom-route
etc..