1DH_INSTALLINIT(1) Debhelper DH_INSTALLINIT(1)
2
3
4
6 dh_installinit - install service init files into package build
7 directories
8
10 dh_installinit [debhelper options] [--name=name] [-n] [-R] [-r] [-d]
11 [-- params]
12
14 dh_installinit is a debhelper program that is responsible for
15 installing init scripts with associated defaults files. In
16 compatibility levels up to and including 10, dh_installinit will also
17 install some systemd related files provided by the debian packaging
18 (see the "FILES" section below). In compatibility levels up to and
19 including 11, dh_installinit will also handle upstart jobs provided in
20 the debian packaging (see the "FILES" for more information on this as
21 well).
22
23 It also automatically generates the postinst and postrm and prerm
24 commands needed to set up the symlinks in /etc/rc*.d/ to start and stop
25 the init scripts.
26
27 In compat 10 or earlier: If a package only ships a systemd service file
28 and no sysvinit script is provided, you may want to exclude the call to
29 dh_installinit for that package (e.g. via -N). Otherwise, you may get
30 warnings from lintian about init.d scripts not being included in the
31 package.
32
34 debian/package.init
35 If this exists, it is installed into etc/init.d/package in the
36 package build directory.
37
38 debian/package.default
39 If this exists, it is installed into etc/default/package in the
40 package build directory.
41
42 debian/package.upstart
43 In compatibility level 11, this file will trigger an error with a
44 reminder about ensuring the proper removal of the upstart file in
45 the previous package version. Please consider using the
46 "rm_conffile" feature from dh_installdeb(1) to ensure the proper
47 removal of previous upstart files.
48
49 In compatibility level 10, if this file exists, it is installed
50 into etc/init/package.conf in the package build directory.
51
52 debian/package.service
53 If this exists, it is installed into
54 lib/systemd/system/package.service in the package build directory.
55 Only used in compat levels 10 and below.
56
57 debian/package.tmpfile
58 If this exists, it is installed into
59 usr/lib/tmpfiles.d/package.conf in the package build directory.
60 (The tmpfiles.d mechanism is currently only used by systemd.) Only
61 used in compat levels 10 and below.
62
64 -n, --no-scripts
65 Do not modify postinst/postrm/prerm scripts.
66
67 -o, --only-scripts
68 Only modify postinst/postrm/prerm scripts, do not actually install
69 any init script, default files, upstart job or systemd service
70 file. May be useful if the file is shipped and/or installed by
71 upstream in a way that doesn't make it easy to let dh_installinit
72 find it.
73
74 Caveat: This will bypass all the regular checks and unconditionally
75 modify the scripts. You will almost certainly want to use this
76 with -p to limit, which packages are affected by the call.
77 Example:
78
79 override_dh_installinit:
80 dh_installinit -pfoo --only-scripts
81 dh_installinit --remaining
82
83 -R, --restart-after-upgrade
84 Do not stop the init script until after the package upgrade has
85 been completed. This is the default behaviour in compat 10.
86
87 In early compat levels, the default was to stop the script in the
88 prerm, and starts it again in the postinst.
89
90 This can be useful for daemons that should not have a possibly long
91 downtime during upgrade. But you should make sure that the daemon
92 will not get confused by the package being upgraded while it's
93 running before using this option.
94
95 --no-restart-after-upgrade
96 Undo a previous --restart-after-upgrade (or the default of compat
97 10). If no other options are given, this will cause the service to
98 be stopped in the prerm script and started again in the postinst
99 script.
100
101 -r, --no-stop-on-upgrade, --no-restart-on-upgrade
102 Do not stop init script on upgrade. This has the side-effect of
103 not restarting the service as a part of the upgrade.
104
105 If you want to restart the service with minimal downtime, please
106 use --restart-after-upgrade (default in compat 10 or later). If
107 you want the service to be restarted but be stopped during the
108 upgrade, then please use --no-restart-after-upgrade (note the
109 "after-upgrade").
110
111 Note that the --no-restart-on-upgrade alias is deprecated and will
112 be removed in compat 12. This is to avoid confusion with the
113 --no-restart-after-upgrade option. The --no-stop-on-upgrade
114 variant was introduced in debhelper 10.2 (included in Debian
115 stretch).
116
117 --no-start
118 Do not start the init script on install or upgrade, or stop it on
119 removal. Only call update-rc.d. Useful for rcS scripts.
120
121 --no-enable
122 Disable the init script on purge, but do not enable them on
123 install. This implies a versioned dependency on init-system-
124 helpers (>= 1.51) as it is the first (functional) version that
125 supports update-rc.d <script> defaults-disabled.
126
127 Note that this option does not affect whether the services are
128 started. Please remember to also use --no-start if the service
129 should not be started.
130
131 Cannot be combined with -uparams, --update-rcd-params=params, or --
132 params.
133
134 -d, --remove-d
135 Remove trailing d from the name of the package, and use the result
136 for the filename the upstart job file is installed as in etc/init/
137 , and for the filename the init script is installed as in
138 etc/init.d and the default file is installed as in etc/default/.
139 This may be useful for daemons with names ending in d. (Note: this
140 takes precedence over the --init-script parameter described below.)
141
142 -uparams --update-rcd-params=params
143 -- params
144 Pass params to update-rc.d(8). If not specified, defaults (or
145 defaults-disabled with --no-enable) will be passed to
146 update-rc.d(8).
147
148 Cannot be combined with --no-enable.
149
150 --name=name
151 Install the init script (and default file) as well as upstart job
152 file using the filename name instead of the default filename, which
153 is the package name. When this parameter is used, dh_installinit
154 looks for and installs files named debian/package.name.init,
155 debian/package.name.default and debian/package.name.upstart instead
156 of the usual debian/package.init, debian/package.default and
157 debian/package.upstart.
158
159 --init-script=scriptname
160 Use scriptname as the filename the init script is installed as in
161 etc/init.d/ (and also use it as the filename for the defaults file,
162 if it is installed). If you use this parameter, dh_installinit will
163 look to see if a file in the debian/ directory exists that looks
164 like package.scriptname and if so will install it as the init
165 script in preference to the files it normally installs.
166
167 This parameter is deprecated, use the --name parameter instead.
168 This parameter is incompatible with the use of upstart jobs.
169
170 --error-handler=function
171 Call the named shell function if running the init script fails. The
172 function should be provided in the prerm and postinst scripts,
173 before the #DEBHELPER# token.
174
176 Note that this command is not idempotent. dh_prep(1) should be called
177 between invocations of this command. Otherwise, it may cause multiple
178 instances of the same text to be added to maintainer scripts.
179
181 debhelper(7), dh_installsystemd(1)
182
183 This program is a part of debhelper.
184
186 Joey Hess <joeyh@debian.org>
187
188 Steve Langasek <steve.langasek@canonical.com>
189
190 Michael Stapelberg <stapelberg@debian.org>
191
192
193
19413.3.4 2021-05-13 DH_INSTALLINIT(1)