• 4
name Punditsdkoslkdosdkoskdo

Auto-configurings postfix using dpkg-set-selection

On Ubuntu 12.04, I'm trying to use dpkg-set-selections to automagically configure postfix on deployed machines with the following:

debconf-set-selections <<EOF
postfix postfix/main_mailer_type select Satellite system 
postfix postfix/root_address string
postfix postfix/mailname string
postfix postfix/relayhost string gw.mydomain.internal
postfix postfix/destinations string $(hostname -f), localhost
DEBIAN_FRONTEND=noninteractive apt-get install postfix mailutils

Unfortunately, the configurator insists on adding to the postfix/destinations (aka mydestinations) config parameter:

postfix postfix/destinations    string, myserver.mydomain.internal, localhost

How can I configure this properly? I want any unqualified mail to go out as and be relayed through the smarthost.

You can configure debconf into non-interactive prompt:

sudo DEBIAN_FRONTEND=noninteractive aptitude install -y -q chef

If you find the complete key, you can also pre-configure the default value:

echo package package/key {boolean,string} {true, some string} | sudo debconf-set-selections
sudo apt-get install package

To be precise:

echo chef chef/chef_server_url string | sudo debconf-set-selections

To find the key, after installing you can look for:

sudo debconf-get-selections | grep chef
# URL of Chef Server (e.g.,
chef    chef/chef_server_url    string  
  • 0
Reply Report
When Im doing an 'apt-get install reportbug' it wants to install packages
> > that is using 'Recommends' and 'Suggests' depending, but I want it to only
> > install packages that it absolutly needs (Such as with the 'Depends'
> > depending). How can I do this with the apt-get command-line tool?
> > 
> > Excerpt from 'apt-cache show reportbug':
> > Depends: python
> > Recommends: python-newt
> > Suggests: postfix | mail-transport-agent, gnupg | pgp, python-ldap (>= 1.8-1)
> You can theoretically use "echo ..." and "apt-get --set-selections"

You mean dpkg --set-selections right? I tried to set exim libdb3 and pgp to
hold. Only exim worked because the two other doesnt exist in stable. On
those I got a "libdb3 doesn't exist." message.

When Im doing an "apt-get install reportbug/testing" I get this:
Selected version 1.42 (Debian:testing) for reportbug
The following extra packages will be installed:
  exim libdb3 pgp python-base reportbug 
The following NEW packages will be installed:
  exim libdb3 pgp python-base reportbug 
The following held packages will be changed:
0 packages upgraded, 5 newly installed, 0 to remove and 0  not upgraded.
Need to get 2071kB of archives. After unpacking 5619kB will be used.

It just overrides my hold settings =(

> But set-selection action is easier with using "dselect"
  • 0
Reply Report

I think the problem is in the install scripts, postfix.preinst has some interesting code about it, and some comments:

Add a 'mydomain' entry in for upgrade? Postfix version 2.3.3-2 and later require changes in Specifically, mydomain must be specified, since hostname(1) is not a fully qualified domain name (FQDN). . Failure to fix this will result in a broken mailer. Decline this option to abort the upgrade, giving you the opportunity to add this configuration yourself. Accept this option to automatically set mydomain based on the FQDN of the machine.*

  • 4
Reply Report