table of contents
- bookworm 13.11.4
- bookworm-backports 13.19~bpo12+1
- testing 13.20
- unstable 13.20
DH_INSTALLDEBCONF(1) | Debhelper | DH_INSTALLDEBCONF(1) |
NAME¶
dh_installdebconf - install files used by debconf in package build directories
SYNOPSIS¶
dh_installdebconf [debhelper options] [-n] [-- params]
DESCRIPTION¶
dh_installdebconf is a debhelper program that is responsible for installing files used by debconf into package build directories.
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.
FILES¶
- debian/package.config
- This is the debconf config script, and is installed into the
DEBIAN directory in the package build directory.
Inside the script, the token #DEBHELPER# is replaced with shell script snippets generated by other debhelper commands.
- debian/package.templates
- This is the debconf templates file, and is installed into the DEBIAN directory in the package build directory.
- debian/po/
- If this directory is present, this program will automatically use
po2debconf(1) to generate merged templates files that include the
translations from there.
For this to work, your package should build-depend on po-debconf.
OPTIONS¶
- -n, --no-scripts
- Do not modify postrm script.
- -- params
- Pass the params to po2debconf.
- -DTOKEN=VALUE, --define TOKEN=VALUE
- Define tokens to be replaced inside the maintainer scripts when it is
generated. Please note that the limitations described in "Limitations
in token names" also applies to tokens defined on the command line.
Invalid token names will trigger an error.
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.
SUBSTITUTION IN MAINTAINER SCRIPTS¶
The dh_installdebconf will automatically replace the following tokens inside a provided maintainer script (if not replaced via -D/--define):
- #DEB_HOST_NAME#, #DEB_BUILD_NAME#, #DEB_TARGET_NAME#
- These tokens are replaced with the respective variable from
dpkg-architecture(1). In almost all cases, you will want use the
#DEB_HOST_NAME variant in a script to ensure
you get the right value when cross-building.
On a best effort, tokens of this pattern that do not match a variable in dpkg-architecture(1) will be left as-is.
- #ENV.NAME#
- These tokens of this form will be replaced with value of the corresponding
environment variable. If the environment variable is unset, the token is
replaced with the empty string.
Note that there are limits on which names can be used (see "Limitations in token names").
- #PACKAGE#
- This token is by default replaced by the package name, which will contain the concrete script.
Limitations in token names¶
All tokens intended to be substituted must match the regex: #[A-Za-z0-9_.+]+#
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.
SEE ALSO¶
This program is a part of debhelper.
AUTHOR¶
Joey Hess <joeyh@debian.org>
2023-01-02 | 13.11.4 |