DH_INSTALLEXAMPLES(1)

πŸ’– DH_INSTALLEXAMPLES β€” bestie, let's install some examples πŸ’–

okay so this is a page from the debhelper manual, and it's all about dh_installexamples. sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

dh_installexamples β€” the tool that puts your example files into your package build directories. she's giving "show them how it's done" energy. πŸ‘‘


🌸 SYNOPSIS 🌸

dh_installexamples [debhelper options] [-A] [-Xitem] [file ...]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, dh_installexamples is a debhelper program and her whole job β€” her entire main character arc β€” is installing examples into usr/share/doc/package/examples inside your package build directories. that's it. that's the gig. πŸ’…

and here's a lil something you need to know: starting from debhelper compatibility level 11 on, dh_install will fall back to looking in debian/tmp for files if it doesn't find them in the current directory (or wherever you told it to look with --sourcedir). so it's got a backup plan. she's prepared. ✨


πŸŽ€ FILES πŸŽ€

  • debian/package.examples β€” this file lists the example files or directories you want installed. iykyk.

real talk though: if upstream ships an examples directory, you're usually gonna want to write examples/* in this file instead of just examples. why?? because the plain examples would create /usr/share/doc/package/examples/examples, which is lowkey never what you actually want. nested examples directories?? it's giving redundant. πŸ™ˆ

also it supports substitution variables in compat 13 and later, as documented over in debhelper(7). slay.


🧚 OPTIONS 🧚

  • -A, --all β€” install any files specified by the command line parameters in ALL packages acted on. all of them. every single one. no cap.
  • --sourcedir=dir β€” look in the directory dir for files to be installed. heads up bestie, this option requires compat 11 or later β€” in compat 10 or earlier it's just silently ignored. πŸ’€
⚠️ and no, this is not the same as the --sourcedirectory option that the dh_auto_* commands use. don't mix them up, they're different girlies. also, you rarely even need this option, because dh_installexamples automatically looks for files in debian/tmp in debhelper compatibility level 11 and above. so like, chill. 🫢
  • --doc-main-package=main-package β€” set the main package for a documentation package. this is used to install the documentation of the documentation package into /usr/share/doc/main-package, as recommended by the Debian policy manual 3.9.7 in Β§12.3. very official. very demure. πŸ“œ

in compat 11 (or later), this option is only useful if debhelper's auto-detection of the main package is wrong. it can also be used to silence a warning from debhelper when the auto-detection fails but the default happens to be correct. so basically it's the "shhh, i got this" button. 🀫

🚨 this option cannot be used when dh_installexamples is instructed to act on multiple packages. if you need it, you'll generally need to combine it with -p to make sure exactly one package is acted on. one package. singular. periodt.

the X-Doc-Main-Package field can be used instead since debhelper/13.28. it has similar semantics but doesn't require command line options β€” so it's the low-effort, high-reward version. iconic. 🌈

  • -Xitem, --exclude=item β€” exclude files that contain item anywhere in their filename from being installed. bye bye, you're not invited. πŸ‘‹
  • file ... β€” install these files (or directories) as examples into the first package acted on. (or into all packages if -A is specified.) so it's first-come-first-served unless you say otherwise. ✨

⭐ NOTES ⭐

okay important vibes check: dh_installexamples will happily copy entire directory hierarchies if you ask her to (similar to cp -a). if it's asked to install a directory, it installs the complete contents of the directory. all of it. every last file. she does not do things halfway. πŸ”₯

⚠️ so maybe don't point her at a giant directory unless that's actually the plan, bestie.

πŸ’œ SEE ALSO πŸ’œ

this program is a part of debhelper. one big happy family. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Joey Hess <joeyh@debian.org>


okay that's the whole page, you're officially educated, go forth and install those examples πŸ’…βœ¨

much love from debhelper 14.5ubuntu1, dated 2026-09-21 β€” catch you on the next man page, bestie πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from