# dh_installdeb

## NAME



           dh_installdeb - install files into the DEBIAN directory
    


## SYNOPSIS



           **dh_installdeb**[_debhelper options_]
    


## DESCRIPTION



           **dh_installdeb** is a debhelper program that is responsible for
           installing files into the _DEBIAN_ directories in package build
           directories with the correct permissions.
    


## FILES



           _package_.postinst
           _package_.preinst
           _package_.postrm
           _package_.prerm
               These maintainer scripts are installed into the _DEBIAN_
               directory.
    
               **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.
    
           _package_.triggers
           _package_.shlibs
               These control files are installed into the _DEBIAN_ directory.
    
               Note that _package_.shlibs is only installed in compat level 9
               and earlier.  In compat 10, please use dh_makeshlibs(1).
    
           _package_.conffiles
               This file will be installed into the _DEBIAN_ directory. The
               provided file will be enriched by debhelper to include all the
               **conffiles** auto-detected by debhelper (the maintainer should
               not list anything there as debhelper assumes it should handle
               that part).
    
               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 to dpkg-maintscript-helper(1)
               commands and parameters.  However, the
               "maint-script-parameters" should _not_ be included as debhelper
               will add 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 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.
    
               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



           **-D** _TOKEN=VALUE_ , **--define** _TOKEN=VALUE_
               Define tokens to be replaced inside the maintainer scripts
               when it is generated.  Please note that the limitations
               described in "Limitations in token names" also applies to
               tokens defined on the command line.  Invalid token names will
               trigger an error.
    
               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**.
    


## SUBSTITUTION IN MAINTAINER SCRIPTS



           The **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.  This includes the snippets
               generated by **dh_installdeb** from _package_.maintscript file (if
               present).
    
           #DEB_HOST__NAME_ #, #DEB_BUILD__NAME_ #, #DEB_TARGET__NAME_ #
               These tokens are replaced with the respective variable from
               dpkg-architecture(1).  In almost all cases, you will want 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 will be replaced with 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.
    


* * *