It also automatically generates the postrm commands needed to interface with debconf. The commands are added to the maintainer scripts by dh_installdeb. See dh_installdeb(1) for an explanation of how that works.
Note that if you use debconf, your package probably needs to depend on it (it will be added to ${misc:Depends} by this program).
Note that for your config script to be called by dpkg, your postinst needs to source debconf's confmodule. dh_installdebconf does not install this statement into the postinst automatically as it is too hard to do it right.
Inside the script, the token #DEBHELPER# is replaced with shell script snippets generated by other debhelper commands.
For this to work, your package should build-depend on po-debconf.
In the simple case, this parameter will cause #TOKEN# to be replaced by VALUE. If VALUE starts with a literal @-sign, then VALUE is expected to point to a file containing the actual value to insert.
An explicit declared token with this parameter will replace built-in tokens.
Test examples to aid with the understanding:
cat >> debian/config <<EOF #SIMPLE# #FILEBASED# EOF echo -n "Complex value" > some-file dh_installdeb --define SIMPLE=direct --define FILEBASED=@some-file
In this example, #SIMPLE# will expand to direct and #FILEBASED# will expand to Complex value.
It is also possible to set package-specific values for a given token. This is useful when dh_installdebconf is acting on multiple packages that need different values for the same token. This is done by prefixing the token name with pkg.package-name..
This can be used as in the following example:
cat >> debian/foo.config <<EOF # Script for #PACKAGE# #TOKEN# EOF cat >> debian/bar.config <<EOF # Script for #PACKAGE# #TOKEN# EOF cat >> debian/baz.config <<EOF # Script for #PACKAGE# #TOKEN# EOF dh_installdebconf -pfoo -pbar -pbaz --define TOKEN=default --define pkg.bar.TOKEN=unique-bar-value \ --define pkg.baz.TOKEN=unique-baz-value
In this example, #TOKEN# will expand to default in debian/foo.config, to unique-bar-value in debian/bar.config and to unique-baz-value in debian/baz.config.
Note that the #pkg.*# tokens will be visible in all scripts acted on. E.g. you can refer to #pkg.bar.TOKEN# inside debian/foo.config and it will be replaced by unique-bar-value.
On a best effort, tokens of this pattern that do not match a variable in dpkg-architecture(1) will be left as-is.
Note that there are limits on which names can be used (see ``Limitations in token names'').
Tokens that do not match that regex will be silently ignored if found in the script template. Invalid token names passed to -D or --define will cause dh_installdebconf to reject the command with an error in most cases.
This program is a part of debhelper.