主要针对bash脚本/程序的debconf开发
0814更新:一个基于debconf开发的demo
普通shell脚本
#!/bin/sh -e
echo -n "Do you like debian? [yn] "
read like
case "$like" in
n*|N*)
echo "Poor misguided one. Why are you installing this package, then?"
/etc/init.d/subliminal_messages start "I like debian."
;;
esac
debconf的templates模板文件示例
Template: packagename/something
Type: [select,multiselect,string,boolean,note,text,password]
Default: [an optional default value]
Description: Blah blah blah?
Blah blah blah. Blah blah. Blah blah blah. Blah blah? Blah
blah blah blah. Blah blah blah. Blah blah.
.
Blah blah blah. Blah blah. Blah blah blah. Blah blah. Blah blah blah.
blah.
Template: ....
....
- 注意
Type
域有select, multiselect, string, boolean, note, text, password
几种类型选一个 Description
域后面紧接着一段简短描述,下面写详细描述。且.
表示一行空行Type
域详细描述:
Type | Description |
---|---|
string | Holds any arbitrary string of data. |
boolean | Holds “true” or “false”. |
select | Holds one of a finite number of possible values. These values must be specified in a field named Choices:. Separate the possible values with commas and spaces, like this: Choices: yes, no, maybe |
multiselect | Just like the select data type, except the user can choose any number of items from the list. This means that the Default: field and the actual value of the question may be a comma and space delimited list of values, just like the Choices: field.Note: For compatability with old versions of Debconf, if you use this data type, please make your package depend on debconf (>= 0.2.26) |
note | This template is a note that can be displayed to the user. As opposed to text, it is something important, that the user really should see. If debconf is not running interactively, it might be saved to a log file |