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
78 -DTOKEN=VALUE, --define TOKEN=VALUE
79 Define tokens to be replaced inside the maintainer scripts when it
80 is generated. Please note that the limitations described in
81 "Limitations in token names" also applies to tokens defined on the
82 command line. Invalid token names will trigger an error.
83
84 In the simple case, this parameter will cause #TOKEN# to be
85 replaced by VALUE. If VALUE starts with a literal @-sign, then
86 VALUE is expected to point to a file containing the actual value to
87 insert.
88
89 An explicit declared token with this parameter will replace built-
90 in tokens.
91
92 Test examples to aid with the understanding:
93
94 cat >> debian/postinst <<EOF
95 #SIMPLE#
96 #FILEBASED#
97 EOF
98 echo -n "Complex value" > some-file
99 dh_installdeb --define SIMPLE=direct --define FILEBASED=@some-file
100
101 In this example, #SIMPLE# will expand to direct and #FILEBASED#
102 will expand to Complex value.
103
104 It is also possible to set package-specific values for a given
105 token. This is useful when dh_installdeb is acting on multiple
106 packages that need different values for the same token. This is
107 done by prefixing the token name with pkg.package-name..
108
109 This can be used as in the following example:
110
111 cat >> debian/foo.postinst <<EOF
112 # Script for #PACKAGE#
113 #TOKEN#
114 EOF
115 cat >> debian/bar.postinst <<EOF
116 # Script for #PACKAGE#
117 #TOKEN#
118 EOF
119 cat >> debian/baz.postinst <<EOF
120 # Script for #PACKAGE#
121 #TOKEN#
122 EOF
123 dh_installdeb -pfoo -pbar -pbaz --define TOKEN=default --define pkg.bar.TOKEN=unique-bar-value \
124 --define pkg.baz.TOKEN=unique-baz-value
125
126 In this example, #TOKEN# will expand to default in
127 debian/foo.postinst, to unique-bar-value in debian/bar.postinst and
128 to unique-baz-value in debian/baz.postinst.
129
130 Note that the #pkg.*# tokens will be visible in all scripts acted
131 on. E.g. you can refer to #pkg.bar.TOKEN# inside
132 debian/foo.postinst and it will be replaced by unique-bar-value.
133
135 The dh_installdeb will automatically replace the following tokens
136 inside a provided maintainer script (if not replaced via -D/--define):
137
138 #DEBHELPER#
139 This token is by default replaced with generated shell snippets
140 debhelper commands. This includes the snippets generated by
141 dh_installdeb from package.maintscript file (if present).
142
143 #DEB_HOST_NAME#, #DEB_BUILD_NAME#, #DEB_TARGET_NAME#
144 These tokens are replaced with the respective variable from
145 dpkg-architecture(1). In almost all cases, you will want use the
146 #DEB_HOST_NAME variant in a script to ensure you get the right
147 value when cross-building.
148
149 On a best effort, tokens of this pattern that do not match a
150 variable in dpkg-architecture(1) will be left as-is.
151
152 #ENV.NAME#
153 These tokens of this form will be replaced with value of the
154 corresponding environment variable. If the environment variable is
155 unset, the token is replaced with the empty string.
156
157 Note that there are limits on which names can be used (see
158 "Limitations in token names").
159
160 #PACKAGE#
161 This token is by default replaced by the package name, which will
162 contain the concrete script.
163
164 Limitations in token names
165 All tokens intended to be substituted must match the regex:
166 #[A-Za-z0-9_.+]+#
167
168 Tokens that do not match that regex will be silently ignored if found
169 in the script template. Invalid token names passed to -D or --define
170 will cause dh_installdeb to reject the command with an error in most
171 cases.
172
174 debhelper(7)
175
176 This program is a part of debhelper.
177
179 Joey Hess <joeyh@debian.org>
180
181
182
18312.7.3 2020-07-27 DH_INSTALLDEB(1)