DH_INSTALL(1)

๐Ÿ’– DH_INSTALL โ€” okay bestie, let's install some files ๐Ÿ’–

So the manual name is dh_install(1) and it lives in the Debhelper cinematic universe, and honestly? This page is a whole journey. Buckle up. ๐ŸŒˆ


โœจ NAME โœจ

dh_install โ€” install files into package build directories. That's it, that's the whole job, and it ate. ๐Ÿ’…


โœจ SYNOPSIS โœจ

dh_install [-Xitem] [--autodest] [--sourcedir=dir] [debhelper options]
[file|dir ... destdir]

โœจ DESCRIPTION โœจ

okay so dh_install is a debhelper program whose entire main character energy is about installing files into package build directories. ๐Ÿ’–

Real talk though โ€” there's a whole friend group of dh_install* commands that handle installing specific types of files (documentation, examples, man pages, and so on), and like... you should use those whenever you can, because they come with extra intelligence baked in for their particular little tasks. ๐Ÿง โœจ dh_install is the one you call for everything else โ€” the stuff where no special intelligence is needed. It's literally the glow-up replacement for the old dh_movefiles command. ๐Ÿ‘‘

This program may be used in one of two ways, and both are valid, both are iconic:

  • Maybe you just have a file or two that the upstream Makefile does not install for you โ€” then you just run dh_install on them and move them into place. Easy.
  • Or maybe you have a large package that builds multiple binary packages ๐Ÿ‘ฏ. In that case you can let the upstream Makefile install everything into debian/tmp, and then bring in dh_install to copy directories and files from there into the proper package build directories.

And here's a fun fact ๐Ÿซถ: from debhelper compatibility level 7 on, dh_install will fall back to looking in debian/tmp for files, if it does not find them in the current directory (or wherever you've told it to look using --sourcedir). Fallback queen fr fr.


โœจ FILES โœจ

debian/package.install

This is where you list the files to install into each package, plus the directory they should be installed to. The format is a set of lines, where each line lists a file or files to install, and at the end of the line it tells you the directory it should be installed in. ๐ŸŽ€

The name of the files (or directories) to install should be given relative to the current directory, while the installation directory is given relative to the package build directory. And yes bestie, you may use wildcards in the names of the files to install. ๐ŸŒŸ

๐Ÿ“Œ Note: if you list exactly one filename or wildcard-pattern on a line by itself, with no explicit destination, then dh_install will automatically guess the destination to use โ€” the same as if the --autodest option were used. Guessing is its love language. ๐Ÿ’…

Supports substitution variables in compat 13 and later, as documented in debhelper(7).

debian/not-installed

Used with the deprecated --list-missing and --fail-missing options. Please refer to dh_missing(1) for the documentation of this file. (Yes, it's giving "go ask your other parent" ๐Ÿ˜ญ)


โœจ OPTIONS โœจ

  • --list-missing โ€” Deprecated: please use dh_missing --list-missing instead. If you use this option, dh_install will call dh_missing with that option after it has processed all the files. Please see dh_missing(1) for the documentation of this option. ๐Ÿ‘€

This option is removed in compat 12. ๐Ÿ’€

  • --fail-missing โ€” Deprecated: please use dh_missing --fail-missing instead. If you use this option, dh_install will call dh_missing with that option after it has processed all the files. Please see dh_missing(1) for the documentation of this option. ๐Ÿ‘€

This option is removed in compat 12. ๐Ÿ’€

  • --sourcedir=dir โ€” Look in the specified directory for files to be installed. ๐Ÿ”

Note that this is not the same as the --sourcedirectory option used by the dh_auto_* commands. You rarely need to use this option, since dh_install automatically looks for files in debian/tmp in debhelper compatibility level 7 and above. (It's giving "I already got you, babe" ๐Ÿซถ)

  • --autodest โ€” Guess as the destination directory to install things to. If this is specified, you should not list destination directories in debian/package.install files or on the command line. Instead, dh_install will guess as follows: ๐ŸŽฒ

Strip off debian/tmp (or the sourcedir if one is given) from the front of the filename, if it is present, and install into the dirname of the filename. So if the filename is debian/tmp/usr/bin, then that directory will be copied to debian/package/usr/. If the filename is debian/tmp/etc/passwd, it will be copied to debian/package/etc/. No cap, that's the whole algorithm. โœจ

  • file|dir ... destdir โ€” Lists files (or directories) to install and where to install them to. The files will be installed into the first package dh_install acts on. ๐Ÿฅ‡

โœจ EXAMPLES โœจ

Here are some small examples of configuration files for dh_install. Adorable, bite-sized, snackable. ๐Ÿ“

# Install my-prog into usr/bin (as "usr/bin/my-prog")
my-prog usr/bin

# Install a plugins directory into usr/share/my-prog
# (as "usr/share/my-prog/plugins/")
plugins usr/share/my-prog

# Install a file with spaces in into usr/share/my-prog/data
# (as "usr/share/my-prog/data/my datafile with spaces.txt")
# ASSUMES COMPAT 13, where substitution patterns are available
my${Space}datafile${Space}with${Space}spaces.txt usr/share/my-prog/data

# Install a library into the multi-arch lib directory
# ASSUMES COMPAT 13, where substitution patterns are available
build/output/libfrop*.so.* usr/lib/${DEB_HOST_MULTIARCH}

โœจ LIMITATIONS โœจ

dh_install cannot rename files or directories โ€” it can only install them with the names they already have into wherever you want in the package build tree. It's not a makeover artist, it's a mover. ๐Ÿšš

There is also no way to filter out results based on build profiles or architecture. For documentation content, consider using dh_installdocs or dh_installexamples, as those helpers account for the nodoc build profile. ๐Ÿ™ˆ

However โ€” plot twist โ€” renaming and filtering can be achieved by using dh-exec with compatibility level 9 or later. An example debian/package.install file using dh-exec could look like: ๐ŸŒŸ

#!/usr/bin/dh-exec
debian/default.conf => /etc/my-package/start.conf
build/foo /usr/bin <!pkg.bar.nofoo>

Please remember the following three things (write them on your hand bestie, there will be a quiz ๐Ÿ“):

  • The package must be using compatibility level 9 or later (see debhelper(7))
  • The package will need a build-dependency on dh-exec.
  • The install file must be marked as executable. โœ…

โœจ SEE ALSO โœจ

debhelper(7)

This program is a part of debhelper. ๐Ÿซถ


โœจ AUTHOR โœจ

Joey Hess <joeyh@debian.org> โ€” thank you for your service, legend ๐Ÿ‘‘


and that's the whole page, bestie!! ๐ŸŽ€ this was version 14.5ubuntu1, dated 2026-09-21, from the DH_INSTALL(1) era โ€” slay, periodt, go install some files, you got this ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from