LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Blogs > Notes on Linux
User Name
Password

Notices



I leave notes here that I find particularly worth remembering myself.
Rate this Entry

Howto automate interactive Debian package installations (debconf preseeding)

Posted 06-08-2010 at 08:44 AM by bittner
Updated 06-08-2010 at 07:59 PM by bittner

Fully automatic installations make sense when you need to install a vast number of machines. For Debian (but not limited to it) there is the FAI project that helps you with those kind of undertakings.

When FAI uses Debian packages (i.e. .deb files) for installation the automatic installation process gets into trouble when such a package asks for manual configuration interactively. Really, this is not specific to FAI: The Debian installer (the installation wizard guiding you through a fresh installation of Debian, e.g. from a bootable CD-ROM) also needs to cope with these kind of situations. The solution is called "debconf preseeding".

With debconf preseeding what you do is telling the Debian package configuration utility debconf to use defined values from a textfile instead of asking interactively. This way you can avoid tricking around with tools like yes (and the like) to satisfy debconf's hunger for values. The only thing Debian needs to know is where to find this file. The preseeding file's content looks somewhat like this:
Code:
sun-java6-bin   shared/accepted-sun-dlj-v1-1    boolean true
sun-java6-jdk   shared/accepted-sun-dlj-v1-1    boolean true
sun-java6-jre   shared/accepted-sun-dlj-v1-1    boolean true
The above content tells debconf to (non-interactively) accept the Sun (in the meantime it's Oracle) Java license which is displayed upon installation of one of the packages sun-java6-bin, -jdk, or -jre.

Syntax explained
The arguments on each line are separated by white space, and have the following meaning: (in sequential order)
  1. Package name
    • Name of the package to install that asks interactively for input
  2. Question template name
    • The identifier of the question from the interactive installation (see templates file in your .deb package)
  3. Answer value type
    • boolean
    • string
    • password
    • select
    • multiselect
    • note
  4. Answer value
    • The value to use for automated installation (comma-separated for multiselect, empty for note)

You can extract a good starting point for your preseeding file using the templates file from the .deb package in question as follows:
Code:
$ dpkg-deb -e packagename.deb ~/control_files/
$ grep -e '^Template:' -e '^Type:' -e '^Default:' \
 ~/control_files/templates | xargs | sed \
 -e 's/\s*Template: /\npackagename\t/g' \
 -e 's/\s*Type: */\t/g' \
 -e 's/\s*Default: */\t/g' > packagename.conf
Replace packagename in the commands above accordingly, then this will extract the essential information, including default values of answers, from your Debian package and write it to packagename.conf. Open this file and add your values at the end of each line, and you're done.

References
Posted in Uncategorized
Views 5661 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 06:07 AM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration