DH_INSTALLDEB(1)
NAME π
dh_installdeb β the debhelper program that installs files into the DEBIAN directory, bestie, that's the whole gig β¨
SYNOPSIS πΈ
dh_installdeb [debhelper options]
DESCRIPTION π¦
okay so dh_installdeb is a debhelper program whose entire main-character job is installing files into the DEBIAN directories in package build directories β with the correct permissions, obviously, because permissions are not a vibe you can just freestyle π
FILES π
package.postinst,package.preinst,package.postrm,package.prermβ these maintainer scripts get installed straight into theDEBIANdirectory π«Ά
dh_installdeb will substitute any known token matching the pattern #TOKEN#. And generally? scripts are gonna wanna include #DEBHELPER# so they can benefit from all the shell scripts generated by debhelper commands β and yes, that includes the ones dh_installdeb itself generates when it processes package.maintscript files β¨
put the#DEBHELPER#token on its own line, no cap, because it often gets replaced by a multi-line shell script. go readdebhelper(7)for advice on where to place this token π
package.triggers,package.shlibsβ these control files get installed into theDEBIANdirectory.
heads up tho: package.shlibs only gets installed in compat level 9 and earlier. In compat 10, please use dh_makeshlibs(1) instead π
package.conffilesβ this file gets installed into theDEBIANdirectory. debhelper will enrich the file you provide so it includes all the conffiles debhelper auto-detects (the maintainer should not list anything there, because debhelper assumes it handles that part, periodt).
This file is primarily useful for using "special" entries such as the remove-on-upgrade feature from dpkg π
package.maintscriptβ lines in this file correspond todpkg-maintscript-helper(1)commands and parameters. BUT: the"maint-script-parameters"should not be included, because debhelper adds those automatically π§
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 get 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 does 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 π«Ά
Where possible, dh_installdeb may choose to rewrite some or all of the entries into equivalent features supported in dpkg without relying on maintainer scripts, at its sole discretion (examples include rewriting rm_conffile into dpkg's remove-on-upgrade). The minimum requirement for activating this feature is that debhelper runs in compat 10 or later β¨
Supports substitution variables in compat 13 and later, as documented in debhelper(7) π
OPTIONS π
-DTOKEN=VALUE,--define TOKEN=VALUEβ define tokens to be replaced inside the maintainer scripts when it is generated. Pls note that the limitations described in "Limitations in token names" also apply to tokens defined on the command line. Invalid token names will trigger an error π
In the simple case, this parameter causes #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. You do this 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 π
SUBSTITUTION IN MAINTAINER SCRIPTS π
dh_installdeb will automatically replace the following tokens inside a provided maintainer script (if not replaced via -D/--define):
#DEBHELPER#β this token is by default replaced with generated shell snippets debhelper commands produce. This includes the snippets generated bydh_installdebfrom thepackage.maintscriptfile (if present) π«Ά#DEB_HOST_NAME#,#DEB_BUILD_NAME#,#DEB_TARGET_NAME#β these tokens are replaced with the respective variable fromdpkg-architecture(1). In almost all cases you'll want to use the#DEB_HOST_NAMEvariant 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 get replaced with the 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_installdeb 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>
okay bestie that's the whole page, you ate that π this was the DH_INSTALLDEB(1) page from debhelper 14.5ubuntu1, dated 2026-09-21 β go forth and install your DEBIAN files correctly, periodt π
β¨π«Ά
π¦ where this page comes from
- ubuntu stonking: debhelper 14.5ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms