dh_installdeb will perform substitution of known tokens of the pattern #TOKEN#. In generally, scripts will want to include the #DEBHELPER# to benefit from the shell scripts generated by debhelper commands (including those from dh_installdeb when it processes package.maintscript files).
The #DEBHELPER# token should be placed on its own line as it is often replaced by a multi-line shell script.
Note that package.shlibs is only installed in compat level 9 and earlier. In compat 10, please use dh_makeshlibs(1).
In compatibility level up and including 11, this control file will be installed into the DEBIAN directory. In compatibility level 12 and later, the file is silently ignored.
Example:
# Correct rm_conffile /etc/obsolete.conf 0.2~ foo # INCORRECT rm_conffile /etc/obsolete.conf 0.2~ foo -- "$@"
In compat 10 or later, any shell metacharacters will be escaped, so arbitrary shell code cannot be inserted here. For example, a line such as "mv_conffile /etc/oldconffile /etc/newconffile" will insert maintainer script snippets into all maintainer scripts sufficient to move that conffile.
It was also the intention to escape shell metacharacters in previous compat levels. However, it did not work properly and as such it was possible to embed arbitrary shell code in earlier compat levels.
The dh_installdeb tool will do some basic validation of some of the commands listed in this file to catch common mistakes. The validation is enabled as a warning since compat 10 and as a hard error in compat 12.
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/postinst <<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_installdeb 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.postinst <<EOF # Script for #PACKAGE# #TOKEN# EOF cat >> debian/bar.postinst <<EOF # Script for #PACKAGE# #TOKEN# EOF cat >> debian/baz.postinst <<EOF # Script for #PACKAGE# #TOKEN# EOF dh_installdeb -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.postinst, to unique-bar-value in debian/bar.postinst and to unique-baz-value in debian/baz.postinst.
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.postinst 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_installdeb to reject the command with an error in most cases.
This program is a part of debhelper.