Subject: Re: Replace system Postfix
To: None <netbsd-users@netbsd.org>
From: Kimmo Suominen <kim@tac.nyc.ny.us>
List: netbsd-users
Date: 01/30/2005 12:39:58
Florian Stoehr <netbsd@wolfnode.de> writes:

| How to do it "gently", being able to uninstall
| the pkgsrc version and have a working postfix
| still alive?

When you install postfix from pkgsrc you should see a message on how
to enable it in NetBSD.

You should *not* copy the binaries from /usr/pkg to /usr, and there is
no need to modify /usr/sbin/sendmail (see "man 8 mailwrapper").

What I do on my systems:

Install the following /etc/rc.conf.d/postfix

    #!/bin/sh
    #
    # Run the pkg version of postfix if it exists.
    # It is usually installed for more features.
    #
    if [ -f /usr/pkg/sbin/postfix ]
    then
	postfix_command=/usr/pkg/sbin/postfix
    fi

Install the following /etc/mailer.conf

    #
    # Use "postfix" from pkgsrc as replacement for "sendmail".
    #
    sendmail        /usr/pkg/sbin/sendmail
    send-mail       /usr/pkg/sbin/sendmail
    mailq           /usr/pkg/sbin/sendmail
    newaliases      /usr/pkg/sbin/sendmail

    #
    # Execute the "real" Sendmail program
    #
    # Note that sendmail will start by default if this path not changed.
    # If you want to use another mailer (postfix, exim, qmail, etc), it is
    # vital that the following lines be commented out.  See rc.conf(5),
    # mailer.conf(5), and afterboot(8) for more details.
    #
    #sendmail       /usr/libexec/sendmail/sendmail
    #send-mail      /usr/libexec/sendmail/sendmail
    #mailq          /usr/libexec/sendmail/sendmail
    #newaliases     /usr/libexec/sendmail/sendmail
    #hoststat       /usr/libexec/sendmail/sendmail
    #purgestat      /usr/libexec/sendmail/sendmail

    #
    # Run Sendmail compatible Postfix commands
    #
    # Notes for running postfix:
    #  - postfix configuration requires either
    #    hostname to be a FQDN, or for $mydomain
    #    to be set in /etc/postfix/main.cf
    #  - postfix does not listen on the network
    #    by default; to enable inbound mail reception,
    #    configure /etc/postfix/main.cf and then uncomment
    #    the smtp service in /etc/postfix/master.cf
    #
    #sendmail       /usr/libexec/postfix/sendmail
    #send-mail      /usr/libexec/postfix/sendmail
    #mailq          /usr/libexec/postfix/sendmail
    #newaliases     /usr/libexec/postfix/sendmail

You can revert by commenting out the pkgsrc section and enabling the
last block for postfix (shown commented out above).

When building postfix, I also have the following in /etc/mk.conf

    PKG_SYSCONFBASE=/etc

If you don't want all configs in /etc, you may consider this instead

    PKG_SYSCONFDIR.postfix=/etc/postfix

which will only affect the postfix package.  This way both the base
and pkgsrc versions will look for configuration files in the same
place.

Regards,
+ Kim