On Sun, Dec 08, 2024 at 07:39:18PM +0300, Michael Tokarev via Postfix-users 
wrote:

> >      - default_database_type
> >      - alias_database
> >      - ...
> 
> How this can depend on the system environment?  Maybe only if it is
> something like (sorry I don't remember the correct syntax) --
> 
>   alias_database = $(if $myhostname = 'foo', hash, cdb)

Syntax aside, there you go! :-) And the system environment is more than
just hostname.  It is the set of available libraries, the content of
dynamicmaps.cf, which depends on shlib_directory, ... and whether when
doing things prematurely during package install you're even seeing the
final main.cf, ...

> Over the years, debian tried to run newaliases in the startup script,
> with a lot of complexity and bug reports.  This is just a given fact,
> a situation we're in which I'm trying to fix.  And yes, this is my
> solution too, exactly, - to do it right before starting postfix if
> needed.  It just looked like unnecessary complexity too which can
> be avoided if postalias didn't complain about network_interfaces.

Sorry, if you're going to have a full-blown MTA, you need to
handle alias updates during any startup no matter what happens during
package installs, so best to just defer it to restart.

> > Again you should not attempt to query this information until the system
> > is in a runnable state.  Leave behind one-time hooks to run once the
> > system is ready, or if live enough do a Postfix restart that will run
> > the hooks.
> 
> https://bugs.debian.org/882141 -- this is what we have in debian, and
> the current solution:
> 
> ln -s "$SERVICEFILE" "$WANTDIR/postfix@-.service"
> for DIR in $(postconf -h multi_instance_directories); do
>     ln -s "$SERVICEFILE" "$WANTDIR/postfix@$(postconf -o inet_interfaces= -hc 
> "$DIR" multi_instance_name).service"
> done

That should be "postconf -hx multi_instance_directories".  But
it is possible to make "postmulti -l" work without loading
any parameters, if that'd really help.  Unclear what problem
you're really trying to solve there.  If it is just to
not have to run "postconf" the win is unclear.

If you want each instance to be a separate systemd job, then clearly
"postmult" is not really your tool of choice.  Postfix actually
has a pluggable multi-instance framework, and someone could write
something else that actually integrates with systemd in some manner,
if they were motivated.  Postmulti is not that complex really, just
a small C program and a shell script.

-- 
    Viktor.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to