DH_INSTALLDEBCONF(1)

okay bestie, welcome to dh_installdebconf πŸ’– β€” it's page 1 of the Debhelper manual, and she's here to handle all ur debconf business so you don't have to 😌✨


πŸŽ€ NAME πŸŽ€

dh_installdebconf β€” install files used by debconf in package build directories πŸ¦‹


✨ SYNOPSIS ✨

dh_installdebconf [debhelper options] [-n] [-- params]

πŸ’… DESCRIPTION πŸ’…

okay so dh_installdebconf is a debhelper program, and her whole job β€” her entire moment, her main character arc β€” is installing the files that debconf needs into ur package build directories 🌸

she ALSO auto-generates the postrm commands you need to talk to debconf, no cap. those commands get added into the maintainer scripts by dh_installdeb. if you wanna know how that whole thing works, go read dh_installdeb(1) β€” she explains it 🫢

note bestie: if you're using debconf, ur package probably needs to depend on it. (this program will add it to ${misc:Depends} for you, so slay πŸ’…)
another note: for ur config script to actually get called by dpkg, ur postinst needs to source debconf's confmodule. dh_installdebconf does NOT install that statement into the postinst automatically β€” because it's genuinely too hard to do it right 😭 fr fr.

πŸ—‚οΈ FILES πŸ—‚οΈ

debian/package.config

this is the debconf config script, and it gets installed into the DEBIAN directory inside the package build directory ✨

inside the script, the token #DEBHELPER# gets replaced with shell script snippets generated by other debhelper commands πŸ‘‘

debian/package.templates

this is the debconf templates file, and it gets installed into the DEBIAN directory inside 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 in there 🌈

for that to work, ur package should build-depend on po-debconf πŸ¦‹


βš™οΈ OPTIONS βš™οΈ

  • -n, --no-scripts β€” do not modify the postrm script. hands off, she's not touching it πŸ™ˆ
  • -- params β€” pass the params to po2debconf πŸ’Œ
  • -DTOKEN=VALUE, --define TOKEN=VALUE β€” define tokens to be replaced inside the maintainer scripts when it's generated. pls note that the limits described in "Limitations in token names" also apply to tokens defined on the command line, and invalid token names will trigger an error πŸ’€

in the simple case, this parameter makes #TOKEN# get 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 explicitly declared token with this parameter will replace built-in tokens πŸ‘‘

test examples to aid with the understanding (not me giving you homework, just receipts):

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's 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. you do this 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 πŸ”

dh_installdebconf will automatically replace the following tokens inside a provided maintainer script (as long as they weren't already replaced via -D/--define) 🫢

  • #DEB_HOST_NAME#, #DEB_BUILD_NAME#, #DEB_TARGET_NAME# β€” these tokens get replaced with the respective variable from dpkg-architecture(1). in almost all cases you will want to 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 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_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>


and that's the whole page bestie, we ate and left no crumbs πŸ“βœ¨ this was version 14.5ubuntu1, dated 2026-09-21 β€” go forth and debconf responsibly πŸ’œπŸ¦‹πŸŽ€

πŸ“¦ where this page comes from