Ftp – Automate proftpd-basic install on ubuntu using apt-get

aptautomated-installautomationftpubuntu-10.04

I'm trying to build a shell script to automate the installation of several packages onto an Ubuntu 10.04 server, and I'm having problems with proftpd-basic.

I'm using the command line

apt-get -qy install proftpd-basic >/tmp/install.log

For most packages, this approach would work fine, however proftpd-basic appears to require some interaction (it asks whether to perform an inetd or standalone installation).

Is it possible for me to pre-select this option on the command line somehow, as I don't want the user to be bothered by this question? – For info, if it matters, I want to choose the 'standalone' option.

Edit:

The interactive part of the process doesn't just require simple y/n answers, it requires that I use arrow keys to navigate to the option I want, requiring me to press enter to make the selection. This might have some bearing upon the solution to this problem.

Best Answer

You can "preseed" answers so that debconf sees you've answered the question already, and doesn't bother asking it again.

You need some tools from the debconf-utils package:

sudo apt-get install debconf-utils

Install your program and manually answer the questions once. Then, you can ask debconf what it stored in its database:

debconf-get-selections | grep proftpd-basic

That information can be input into debconf-set-selections (either by piping, or reading from a file).

Warner's answer is more cross-platform (debconf is a Debian-and-derivates only technology), but doesn't always work between versions, if the questions change; or in the case you have some debconf questions that are only asked if you have other packages installed.