I have a package, lets call it foo, that has a dependency which is in turn dependent on postfix. I am trying to automate the install of foo by answering the questions using debconf. The requirements for foo is that it has to be able to install and configure everything and must be installed using
sudo apt-get install foo
So something like this wouldn't be acceptable:
DEBIAN_FRONTEND=noninteractive apt-get install -y foo
Also, note that foo is being installed on a fresh install of Ubuntu.
The first thing I tried was this (in my preinst script):
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
But that didn't work. The questions still appeared in the installation.
Then I tried this:
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix
And this:
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get install -y postfix << _EOT
y
EOT
And then I thought:
What if debconf-utils were put in Pre-Depends? That didn't work.
However, if I do the following (from the command line rather then the preinst script), then the installation works without questions:
sudo apt-get install debconf-utils
echo "postfix postfix/mailname string your.hostname.com" | debconf-set-selections
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
sudo apt-get install foo
However, that isn't acceptable for the requirements I've been given.
So now I'm stuck. If anyone can pick out what I'm doing wrong that would be much appreciated as I've searched for a while looking for the answer.