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