debconf_specification.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?xml version="1.0"?>
  2. <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3. "dtd/docbook-xml/4.1.2/docbookx.dtd" [
  4. <!ENTITY statuscodes_table SYSTEM "include/statuscodes.xml">
  5. <!ENTITY command_list SYSTEM "include/commands.xml">
  6. <!ENTITY priority_table SYSTEM "include/priorities.xml">
  7. <!ENTITY type_table SYSTEM "include/types.xml">
  8. <!ENTITY % versiondata SYSTEM "include/version.xml"> %versiondata;
  9. ]>
  10. <article>
  11. <articleinfo>
  12. <title>Configuration management</title>
  13. <subtitle>Protocol version 2.1</subtitle>
  14. <releaseinfo>Revision 7.1, Debian Policy &version;, &date;</releaseinfo>
  15. <author>
  16. <firstname>Wichert</firstname>
  17. <surname>Akkerman</surname>
  18. <affiliation>
  19. <orgname>The Debian Project</orgname>
  20. <address><email>wakkerma@debian.org</email></address>
  21. </affiliation>
  22. </author>
  23. <author>
  24. <firstname>Joey</firstname>
  25. <surname>Hess</surname>
  26. <affiliation>
  27. <orgname>The Debian Project</orgname>
  28. <address><email>joeyh@debian.org</email></address>
  29. </affiliation>
  30. </author>
  31. <copyright>
  32. <year>1998</year>
  33. <year>1999</year>
  34. <year>2000</year>
  35. <holder>Wichert Akkerman and Joey Hess</holder>
  36. </copyright>
  37. <legalnotice>
  38. <para>
  39. This text is copyright by the authors under the terms of the
  40. BSD license, sans advertising clause.
  41. </para>
  42. </legalnotice>
  43. </articleinfo>
  44. <sect1>
  45. <title>
  46. Introduction
  47. </title>
  48. <para>
  49. Configuration management is quickly becoming a very important issue.
  50. Having programs which do cool stuff is great, but we need to store
  51. their configuration as well. We see more and more different
  52. configuration systems being introduced all the time, which is not very
  53. practical. This text introduces a general configuration management
  54. system which flexible enough to be used for all kinds of applications.
  55. </para>
  56. </sect1>
  57. <sect1>
  58. <title>
  59. Configuration Data
  60. </title>
  61. <sect2>
  62. <title>
  63. The configuration space
  64. </title>
  65. <para>
  66. All configuration information is stored in what I call the
  67. configuration space. This is a database with a special design
  68. which resembles the method we look at configuration information.
  69. This is done by defining a hierarchy of information. Each package
  70. receives its own space in the hierarchy. Each package is free to
  71. use a flat space, or divide its space further into
  72. sub-hierarchies. If multiple packages share a common purpose they
  73. may use a shared toplevel hierarchy, preferably with the same name
  74. as a shared (virtual) package name (for example, both
  75. <application>mutt</application> and <application>elm</application>
  76. can use <literal>mail-reader</literal>,
  77. <application>strn</application> and <application>nn</application>
  78. could use <literal>news-reader</literal>). This
  79. shared tree can also be used as a default, ie a variable
  80. <literal>news-reader/nntpserver</literal> can be used by
  81. <application>strn</application> if <literal>strn/nntpserver</literal>
  82. does not exist.
  83. </para>
  84. <para>
  85. Each variable in the configuration space has some information
  86. associated with it. Most importantly, it has a value. It also may
  87. have a set of flags and a set of substitution data.
  88. </para>
  89. </sect2>
  90. </sect1>
  91. <sect1>
  92. <title>
  93. Templates
  94. </title>
  95. <para>
  96. Each variable in the configuration space is associated with some
  97. meta-data. The minimum meta-data associated with a variable is:
  98. long and short description, type, and default value. The meta-data
  99. is essentially static; the protocol described below does not allow it
  100. to be changed.
  101. </para>
  102. <para>
  103. The meta-data exists in a space with similar naming
  104. properties to the configuration space described above, and typically
  105. one variable in the configuration space will have associated with it
  106. metadata with the same name in the meta-data space. However, this need
  107. not be the case; many different variables can all be associated with
  108. the same meta-data. In effect the meta-data serves as a template
  109. for the configuration variable.
  110. </para>
  111. <sect2>
  112. <title>
  113. Template information
  114. </title>
  115. <para>
  116. So, what do we need to store in a variable template? Of course we
  117. need a name to identify the template. Template names are made up of
  118. components separated by the character `/' (slash).
  119. Each component is limited to alphanumerics and `+' `-' `.' `_'
  120. (plus, minus, full stop, underscore).
  121. </para>
  122. <para>
  123. A type is also needed so data can be verified. Here is a table
  124. of common types; implementations are free to make up more.
  125. &type_table;
  126. </para>
  127. <para>
  128. Of course a default value is useful as well, and
  129. finally we need a description of the variable. We actually use two
  130. descriptions: a short one (limited to 50 characters or so) and an
  131. extended one.
  132. </para>
  133. <para>
  134. The extended description may be word-wrapped by the
  135. FrontEnd. To make separate paragraphs in it, use <literal>.</literal>
  136. on a line by itself to separate them. Text in the extended
  137. description that is prefaced by additional whitespace will not be
  138. wordwrapped. Both the description and extended
  139. description may have substitutions embedded in them. Ie,
  140. <literal>${foo}</literal>. These will be expanded when the
  141. descriptions are displayed.
  142. </para>
  143. <para>
  144. This information is stored in a template file that consists of
  145. stanzas in a rfc-822 compliant format, separated by blank lines.
  146. Here is an example:
  147. <programlisting>
  148. Template: hostname
  149. Type: string
  150. Default: debian
  151. Description: unqualified hostname for this computer
  152. This is the name by which this computer will be known on the network. It
  153. has to be a unique name in your domain.
  154. Template: domain
  155. Type: string
  156. Description: domain for this computer
  157. This is the domain your computer is a member of. Typically it is
  158. something like "mycompany.com" or "myuniversity.edu".
  159. </programlisting>
  160. </para>
  161. <para>
  162. For localization, the description field (and also the choices
  163. field of a select or multiselect type question, and the
  164. default field of a string or password type question) can be
  165. supplemented with versions for other languages. These are
  166. named <emphasis>Description-ll</emphasis>,
  167. <emphasis>Description-ll_LL</emphasis>,
  168. <emphasis>Description-ll_LL.encoding</emphasis> and so on.
  169. </para>
  170. </sect2>
  171. </sect1>
  172. <sect1>
  173. <title>
  174. Configuration frontends
  175. </title>
  176. <para>
  177. Of course applications can use the database and meta-database directly.
  178. But there should be a simple system to interact with the user that is
  179. simple and modular enough to be used with systems ranging from
  180. shell-scripts to Fortran programs. To do this we define a general
  181. frontend that can be driven using the simplest and most common form of
  182. communication: stdin and stdout.
  183. </para>
  184. <para>
  185. Using this simple form of communication gives us a great advantage: it
  186. becomes easy to change the frontend. That means the user can switch
  187. between a console, a graphical or even a web-interface at will.
  188. </para>
  189. <para>
  190. Besides being able to switch between types of frontends there is
  191. another important aspect of a good user interface: user friendliness.
  192. We have to account for the fact that some users know more then others
  193. and change the information we show or ask from the user. We do this by
  194. giving everything a priority and giving the user control over what
  195. kind of questions he wants to see. Experts can request to see
  196. everything, while novices get the option of only seeing only important
  197. questions. Finally there is an option to simply skip all questions, so
  198. it becomes possible to do automatic configuration using default values
  199. or values that are downloaded into the database from a remote
  200. location. This makes it simple for example to install and manage
  201. clusters or lab rooms or do installs for dummies.
  202. </para>
  203. </sect1>
  204. <sect1>
  205. <title>
  206. Communication with the frontend
  207. </title>
  208. <para>
  209. This communication between the frontend and the application should be
  210. as simple as possible. Since most IO implementations default to
  211. line-buffered IO, so we use a simple language where each command is
  212. exactly one line.
  213. </para>
  214. <para>
  215. After sending each command to stdout, the client
  216. should read one line from stdin. This is the response to the command,
  217. and it will be in the form of a number followed by whitespace and an
  218. optional string of text. The number is the status code, while the
  219. text provides additional information.
  220. &statuscodes_table;
  221. </para>
  222. <para>
  223. Here are the currently supported commands.
  224. </para>
  225. <itemizedlist>
  226. &command_list;
  227. </itemizedlist>
  228. </sect1>
  229. <sect1>
  230. <title>
  231. Debian install-time configuration
  232. </title>
  233. <para>
  234. Debian has had an excellent packaging system for a long time now. There is
  235. one thing missing though: a system to handle the configuration of
  236. packages so we don't have to stop the installation every time a package
  237. needs some data from the user or wants to show some information.
  238. </para>
  239. <para>
  240. We want to make a package which does not break older dpkg's, and we
  241. want to be able to get the configuration information before the package
  242. is unpacked. To do this we add two new files, config and templates, to
  243. the control.tar.gz of a .deb package. Since all installation-software
  244. (apt, dselect, dpkg) download the package before installing it, we can
  245. extract this before the package is unpacked.
  246. </para>
  247. <para>
  248. The templates file lists the templates for variables that this package
  249. uses. This is done using the format as used in the example in the
  250. section on templates.
  251. </para>
  252. <para>
  253. The config-file contains a new element, which I call the
  254. configmodule. This is a program that will determine the
  255. configuration before the package is unpacked. This means it is
  256. usually run <emphasis>before</emphasis> the preinst, and before
  257. the package is unpacked!
  258. <note>
  259. <simpara>Please see debconf-devel(7) for details.</simpara>
  260. </note>
  261. This is done to make sure that we can
  262. use the desired configuration in the preinst if necessary.
  263. </para>
  264. <para>
  265. How does the configmodule get its information? The configmodule
  266. needs a way to retrieve information from the configuration space, ask
  267. the user for information if necessary, etc. But we don't want to
  268. implement a user interface for each package. To solve this we use a
  269. separate frontend as specified in the section on frontends.
  270. </para>
  271. </sect1>
  272. </article>