On Fri, Dec 26, 2025 at 08:46:46PM -0500, Wietse Venema via Postfix-users wrote:

> > Basically after installing a new Postfix, always run "make" in the
> > primary configuration directory (perhaps also in any additional
> > instance directories that have a Makefile).
> 
> How would this automate the migration from one default database
> type to another? As a start one would replace hard-coded "local
> file" database types in main.cf and master.cf with parameterized
> types.

If, as I do, a user is writing tables in a form such as:

    indexed = ${default_database_type}:${config_directory}/
    virtual_alias_maps = ${indexed}virtual

then a change of the default database type does not require changes to
main.cf, beyond perhaps:

    postconf -e "default_database_type = lmdb"

if and only if "postconf -xh default_database_type" returns a no longer
available driver.  In other words some indirection in main.cf is needed
to support future changes.

Af for the Makefile, making the suffix dependent on the default database
type is a bit tricky, "postconf" does not currently report the file
suffix associated with the default database type, so one would
need (GNU make) shell code fragments like:

    CMDDIR := ${shell postconf -xh command_directory}
    DBTYPE := ${shell postconf -xh default_database_type}
    DBEXT := ${shell case $(DBTYPE) in \
                    cdb) echo .cdb;; \
                    lmdb) echo .lmdb;; \
                    hash|btree) echo .db;; \
                    *) exit 1;; \
                    esac}

    .SUFFIXES: $(DBEXT)

    aliases$(DBEXT): aliases
            $(CMDDIR)/postalias $(DBTYPE):$<

    %$(DBEXT): %
            $(CMDDIR)/postmap $(DBTYPE):$<

    ...

to set the default suffix in the Makefile.  Some determined effort is
required to ensure ongoing maintainability.

-- 
    Viktor.  🇺🇦 Слава Україні!
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to