Re: [exim] Conditional file include?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: John W. Baxter
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] Conditional file include?
On 8/24/07 2:34 PM, "D. Dante Lorenso" <dante@???> wrote:

> Phil Pennock wrote:
>> On 2007-08-24 at 14:21 -0500, D. Dante Lorenso wrote:
>>> I'm trying to do a conditional file include so that I can roll out the
>>> same exim configs to several hosts. I can't seem to get this to work:
>>>
>>> .include /etc/exim/host/${primary_hostname}.conf
>>>
>>> ---
>>> Starting exim: 2007-08-24 14:10:54 Exim configuration
>>> error in line 5 of /etc/exim/exim.conf: failed to open
>>> included configuration file
>>> /etc/exim/host/${primary_hostname}.conf
>>> ---
>>>
>>> Can this be done? Does string replacement happen before include? If
>>> not, is there some type of if/then/else or switch syntax that could be
>>> cooked up to do different includes based on the value in $primary_hostname?
>>
>> This is all fully yet concisely documented in section 6.3 of The Exim
>> Specification, "6.3 File inclusions in the configuration file", which
>> states how early in the parsing process the inclusions are done, what
>> parsing steps happen _before_ the include processing, etc.
>>
>> The Exim Specification is available online (via www.exim.org and its
>> mirrors) and should also have been included with your distribution as a
>> plaintext file named "spec.txt".
>>
>> Sections 6.3 through 6.9 are all likely to be of interest to you.
>
> Thanks for your RTFM suggestion. Did that. Was hoping someone might
> have an architecture recommendation on how I CAN do what I'm trying to
> do ...
>
> Notice also my question about asking for alternatives based on
> $primary_hostname. I have a follow up message in this thread somewhere
> where I also present option for using .ifdef but need help figuring out
> how to conditionally define macros.


We manage our configurations in Subversion. For those that need to work
this way, we install with a script that runs patch against a suitable
host-specific file (all the patchable things are Exim macros and are
gathered together in one bunch early in the unpatched file for convenience).

We could have used sed; the developer who put it together is conversant with
patch (including making inputs for it by hand). (Unfortunately, the
developer put an invisible space after the = in the lines to be replaced,
making errors easier--for me--to make.)

--john