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 Only used in compat levels 10 and below.
61
63 -n, --no-scripts
64 Do not modify postinst/postrm/prerm scripts.
65
66 -o, --only-scripts
67 Only modify postinst/postrm/prerm scripts, do not actually install
68 any init script, default files, upstart job or systemd service
69 file. May be useful if the file is shipped and/or installed by
70 upstream in a way that doesn't make it easy to let dh_installinit
71 find it.
72
73 Caveat: This will bypass all the regular checks and unconditionally
74 modify the scripts. You will almost certainly want to use this
75 with -p to limit, which packages are affected by the call.
76 Example:
77
78 override_dh_installinit:
79 dh_installinit -pfoo --only-scripts
80 dh_installinit --remaining
81
82 -R, --restart-after-upgrade
83 Do not stop the init script until after the package upgrade has
84 been completed. This is the default behaviour in compat 10.
85
86 In early compat levels, the default was to stop the script in the
87 prerm, and starts it again in the postinst.
88
89 This can be useful for daemons that should not have a possibly long
90 downtime during upgrade. But you should make sure that the daemon
91 will not get confused by the package being upgraded while it's
92 running before using this option.
93
94 --no-restart-after-upgrade
95 Undo a previous --restart-after-upgrade (or the default of compat
96 10). If no other options are given, this will cause the service to
97 be stopped in the prerm script and started again in the postinst
98 script.
99
100 -r, --no-stop-on-upgrade, --no-restart-on-upgrade
101 Do not stop init script on upgrade. This has the side-effect of
102 not restarting the service as a part of the upgrade.
103
104 If you want to restart the service with minimal downtime, please
105 use --restart-after-upgrade (default in compat 10 or later). If
106 you want the service to be restarted but be stopped during the
107 upgrade, then please use --no-restart-after-upgrade (note the
108 "after-upgrade").
109
110 Note that the --no-restart-on-upgrade alias is deprecated and will
111 be removed in compat 12. This is to avoid confusion with the
112 --no-restart-after-upgrade option. The --no-stop-on-upgrade
113 variant was introduced in debhelper 10.2 (included in Debian
114 stretch).
115
116 --no-start
117 Do not start the init script on install or upgrade, or stop it on
118 removal. Only call update-rc.d. Useful for rcS scripts.
119
120 --no-enable
121 Disable the init script on purge, but do not enable them on
122 install. This implies a versioned dependency on init-system-
123 helpers (>= 1.51) as it is the first (functional) version that
124 supports update-rc.d <script> defaults-disabled.
125
126 Note that this option does not affect whether the services are
127 started. Please remember to also use --no-start if the service
128 should not be started.
129
130 Cannot be combined with -uparams, --update-rcd-params=params, or --
131 params.
132
133 -d, --remove-d
134 Remove trailing d from the name of the package, and use the result
135 for the filename the upstart job file is installed as in etc/init/
136 , and for the filename the init script is installed as in
137 etc/init.d and the default file is installed as in etc/default/.
138 This may be useful for daemons with names ending in d. (Note: this
139 takes precedence over the --init-script parameter described below.)
140
141 -uparams --update-rcd-params=params
142 -- params
143 Pass params to update-rc.d(8). If not specified, defaults (or
144 defaults-disabled with --no-enable) will be passed to
145 update-rc.d(8).
146
147 Cannot be combined with --no-enable.
148
149 --name=name
150 Install the init script (and default file) as well as upstart job
151 file using the filename name instead of the default filename, which
152 is the package name. When this parameter is used, dh_installinit
153 looks for and installs files named debian/package.name.init,
154 debian/package.name.default and debian/package.name.upstart instead
155 of the usual debian/package.init, debian/package.default and
156 debian/package.upstart.
157
158 --init-script=scriptname
159 Use scriptname as the filename the init script is installed as in
160 etc/init.d/ (and also use it as the filename for the defaults file,
161 if it is installed). If you use this parameter, dh_installinit will
162 look to see if a file in the debian/ directory exists that looks
163 like package.scriptname and if so will install it as the init
164 script in preference to the files it normally installs.
165
166 This parameter is deprecated, use the --name parameter instead.
167 This parameter is incompatible with the use of upstart jobs.
168
169 --error-handler=function
170 Call the named shell function if running the init script fails. The
171 function should be provided in the prerm and postinst scripts,
172 before the #DEBHELPER# token.
173
175 Note that this command is not idempotent. dh_prep(1) should be called
176 between invocations of this command. Otherwise, it may cause multiple
177 instances of the same text to be added to maintainer scripts.
178
180 debhelper(7), dh_installsystemd(1)
181
182 This program is a part of debhelper.
183
185 Joey Hess <joeyh@debian.org>
186
187 Steve Langasek <steve.langasek@canonical.com>
188
189 Michael Stapelberg <stapelberg@debian.org>
190
191
192
19313.11.4 2023-01-22 DH_INSTALLINIT(1)