1DH_INSTALLDEB(1) Debhelper DH_INSTALLDEB(1)
2
3
4
6 dh_installdeb - install files into the DEBIAN directory
7
9 dh_installdeb [debhelperĀ options]
10
12 dh_installdeb is a debhelper program that is responsible for installing
13 files into the DEBIAN directories in package build directories with the
14 correct permissions.
15
17 package.postinst
18 package.preinst
19 package.postrm
20 package.prerm
21 These maintainer scripts are installed into the DEBIAN directory.
22
23 dh_installdeb will perform substitution of known tokens of the
24 pattern #TOKEN#. In generally, scripts will want to include the
25 #DEBHELPER# to benefit from the shell scripts generated by
26 debhelper commands (including those from dh_installdeb when it
27 processes package.maintscript files).
28
29 The #DEBHELPER# token should be placed on its own line as it is
30 often replaced by a multi-line shell script.
31
32 package.triggers
33 package.shlibs
34 These control files are installed into the DEBIAN directory.
35
36 Note that package.shlibs is only installed in compat level 9 and
37 earlier. In compat 10, please use dh_makeshlibs(1).
38
39 package.conffiles
40 Historically, this file was needed to manually mark files files as
41 conffiles. However, it has become de facto obsolete since
42 debhelper automatically computed which files should be marked as
43 conffiles.
44
45 In compatibility level up and including 11, this control file will
46 be installed into the DEBIAN directory. In compatibility level 12
47 and later, the file is silently ignored.
48
49 package.maintscript
50 Lines in this file correspond to dpkg-maintscript-helper(1)
51 commands and parameters. However, the "maint-script-parameters"
52 should not be included as debhelper will add those automatically.
53
54 Example:
55
56 # Correct
57 rm_conffile /etc/obsolete.conf 0.2~ foo
58 # INCORRECT
59 rm_conffile /etc/obsolete.conf 0.2~ foo -- "$@"
60
61 In compat 10 or later, any shell metacharacters will be escaped, so
62 arbitrary shell code cannot be inserted here. For example, a line
63 such as "mv_conffile /etc/oldconffile /etc/newconffile" will insert
64 maintainer script snippets into all maintainer scripts sufficient
65 to move that conffile.
66
67 It was also the intention to escape shell metacharacters in
68 previous compat levels. However, it did not work properly and as
69 such it was possible to embed arbitrary shell code in earlier
70 compat levels.
71
72 The dh_installdeb tool will do some basic validation of some of the
73 commands listed in this file to catch common mistakes. The
74 validation is enabled as a warning since compat 10 and as a hard
75 error in compat 12.
76
77 Supports substitution variables in compat 13 and later as
78 documented in debhelper(7).
79
81 -DTOKEN=VALUE, --define TOKEN=VALUE
82 Define tokens to be replaced inside the maintainer scripts when it
83 is generated. Please note that the limitations described in
84 "Limitations in token names" also applies to tokens defined on the
85 command line. Invalid token names will trigger an error.
86
87 In the simple case, this parameter will cause #TOKEN# to be
88 replaced by VALUE. If VALUE starts with a literal @-sign, then
89 VALUE is expected to point to a file containing the actual value to
90 insert.
91
92 An explicit declared token with this parameter will replace built-
93 in tokens.
94
95 Test examples to aid with the understanding:
96
97 cat >> debian/postinst <<EOF
98 #SIMPLE#
99 #FILEBASED#
100 EOF
101 echo -n "Complex value" > some-file
102 dh_installdeb --define SIMPLE=direct --define FILEBASED=@some-file
103
104 In this example, #SIMPLE# will expand to direct and #FILEBASED#
105 will expand to Complex value.
106
107 It is also possible to set package-specific values for a given
108 token. This is useful when dh_installdeb is acting on multiple
109 packages that need different values for the same token. This is
110 done by prefixing the token name with pkg.package-name..
111
112 This can be used as in the following example:
113
114 cat >> debian/foo.postinst <<EOF
115 # Script for #PACKAGE#
116 #TOKEN#
117 EOF
118 cat >> debian/bar.postinst <<EOF
119 # Script for #PACKAGE#
120 #TOKEN#
121 EOF
122 cat >> debian/baz.postinst <<EOF
123 # Script for #PACKAGE#
124 #TOKEN#
125 EOF
126 dh_installdeb -pfoo -pbar -pbaz --define TOKEN=default --define pkg.bar.TOKEN=unique-bar-value \
127 --define pkg.baz.TOKEN=unique-baz-value
128
129 In this example, #TOKEN# will expand to default in
130 debian/foo.postinst, to unique-bar-value in debian/bar.postinst and
131 to unique-baz-value in debian/baz.postinst.
132
133 Note that the #pkg.*# tokens will be visible in all scripts acted
134 on. E.g. you can refer to #pkg.bar.TOKEN# inside
135 debian/foo.postinst and it will be replaced by unique-bar-value.
136
138 The dh_installdeb will automatically replace the following tokens
139 inside a provided maintainer script (if not replaced via -D/--define):
140
141 #DEBHELPER#
142 This token is by default replaced with generated shell snippets
143 debhelper commands. This includes the snippets generated by
144 dh_installdeb from package.maintscript file (if present).
145
146 #DEB_HOST_NAME#, #DEB_BUILD_NAME#, #DEB_TARGET_NAME#
147 These tokens are replaced with the respective variable from
148 dpkg-architecture(1). In almost all cases, you will want use the
149 #DEB_HOST_NAME variant in a script to ensure you get the right
150 value when cross-building.
151
152 On a best effort, tokens of this pattern that do not match a
153 variable in dpkg-architecture(1) will be left as-is.
154
155 #ENV.NAME#
156 These tokens of this form will be replaced with value of the
157 corresponding environment variable. If the environment variable is
158 unset, the token is replaced with the empty string.
159
160 Note that there are limits on which names can be used (see
161 "Limitations in token names").
162
163 #PACKAGE#
164 This token is by default replaced by the package name, which will
165 contain the concrete script.
166
167 Limitations in token names
168 All tokens intended to be substituted must match the regex:
169 #[A-Za-z0-9_.+]+#
170
171 Tokens that do not match that regex will be silently ignored if found
172 in the script template. Invalid token names passed to -D or --define
173 will cause dh_installdeb to reject the command with an error in most
174 cases.
175
177 debhelper(7)
178
179 This program is a part of debhelper.
180
182 Joey Hess <joeyh@debian.org>
183
184
185
18613.3.4 2021-05-13 DH_INSTALLDEB(1)