I leave notes here that I find particularly worth remembering myself.
Howto automate interactive Debian package installations (debconf preseeding)
Tags administration, debian, package
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:
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)
You can extract a good starting point for your preseeding file using the templates file from the .deb package in question as follows:
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
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
Syntax explained
The arguments on each line are separated by white space, and have the following meaning: (in sequential order)
- Package name
- Name of the package to install that asks interactively for input
- Question template name
- The identifier of the question from the interactive installation (see templates file in your .deb package)
- Answer value type
- boolean
- string
- password
- select
- multiselect
- note
- 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
References
- Manage interactive input (FAIwiki)
- Debian Installer: Preseed (DebianWiki)
- The Debconf Programmer's Tutorial (background reading)
Total Comments 0