UNATTENDED PACKAGE INSTALLATION ON DEBIAN GNU/LINUX =================================================== Martin Rubli, 2005-08-09 References: debconf(7) [provided by package debconf-doc] debconf.conf(5) expect(1) METHOD 1: Using debconf databases --------------------------------- When packages are being installed and about to be configured, debconf retrieves information about questions to be asked from a number of databases configured in /etc/debconf.conf. By default all answers previously given are stored in the text file database /var/cache/debconf/config.dat. Each setting is stored with a name of pattern "packagename/settingname". If a question "foo/bar" is about to be asked, a corresponding entry is looked for in all available databases. In case of success the previously stored answer is used, otherwise the question is asked using the currently set frontend (configurable via "dpkg-reconfigure debconf"). With the help of environment variables additional databases can temporarily be added to the ones configured in /etc/debconf.conf. One such variable is the fallback database which is searched for entries that cannot be found in the primary databases. EXAMPLE: The portmap package asks the following question during configuration: Should portmap be bound to the loopback address? [yes|no] The corresponding entry in the debconf database may look as follows: Name: portmap/loopback Template: portmap/loopback Value: true Owners: portmap Flags: seen If portmap should be installed on a different machine without asking the question, a file can be prepared containing the above entry (e.g. /root/portmap.conf). This file is then set up as a fallback database for debconf using: export DEBCONF_DB_FALLBACK=File{/root/portmap.conf} If the portmap package is now installed (e.g. using "apt-get install portmap"), the answer ("true") is automatically retrieved from the fallback database. In the same way the entire primary debconf database file can be copied from one machine to another where it is used as a fallback database using the mechanism described above. More alternatives include setting up an LDAP server that provides the debconf database or mounting a debconf database over the network. METHOD 2: Using an expect script -------------------------------- If the debconf frontend is set to "readline", the expect script language can be used to answer the questions, although this approach is much less robust. First, set the debconf frontend temporarily to use readline. export DEBIAN_FRONTEND=readline Now, scripts like the following can be used: #!/usr/bin/expect -f eval spawn apt-get -y install portmap expect "Should portmap be bound to the loopback address? " send -- "y\r" interact