1DH_INSTALLSYSTEMD(1) Debhelper DH_INSTALLSYSTEMD(1)
2
3
4
6 dh_installsystemd - install systemd unit files
7
9 dh_installsystemd [debhelper options] [--restart-after-upgrade]
10 [--no-stop-on-upgrade] [--no-enable] [--no-start] [--name=name]
11 [unit file ...]
12
14 dh_installsystemd is a debhelper program that is responsible for
15 installing package maintainer supplied systemd unit files.
16
17 It also finds the service files installed by a package and generates
18 preinst, postinst, and prerm code blocks for enabling, disabling,
19 starting, stopping, and restarting the corresponding systemd services,
20 when the package is installed, updated, or removed. These snippets are
21 added to the maintainer scripts by dh_installdeb(1).
22
23 deb-systemd-helper(1) is used to enable and disable systemd units, thus
24 it is not necessary that the machine actually runs systemd during
25 package installation time, enabling happens on all machines in order to
26 be able to switch from sysvinit to systemd and back.
27
28 dh_installsystemd operates on all unit files installed by a package.
29 For only generating blocks for specific unit files, pass them as
30 arguments, "dh_installsystemd quota.service". Specific unit files can
31 be excluded from processing using the -X common debhelper(1) option.
32
34 debian/package.mount, debian/package.path, debian/package@.path,
35 debian/package.service, debian/package@.service, debian/package.socket,
36 debian/package@.socket, debian/package.target, debian/package@.target,
37 debian/package.timer, debian/package@.timer
38 If any of those files exists, they are installed into
39 lib/systemd/system/ in the package build directory.
40
41 debian/package.tmpfile
42 Only used in compat 12 or earlier. In compat 13+, this file is
43 handled by dh_installtmpfiles(1) instead.
44
45 If this exists, it is installed into usr/lib/tmpfiles.d/ in the
46 package build directory. Note that the "tmpfiles.d" mechanism is
47 currently only used by systemd.
48
50 --no-enable
51 Disable the service(s) on purge, but do not enable them on install.
52
53 Note that this option does not affect whether the services are
54 started. Please remember to also use --no-start if the service
55 should not be started.
56
57 --name=name
58 This option controls several things.
59
60 It changes the name that dh_installsystemd uses when it looks for
61 maintainer provided systemd unit files as listed in the "FILES"
62 section. As an example, dh_installsystemd --name foo will look for
63 debian/package.foo.service instead of debian/package.service).
64 These unit files are installed as name.unit-extension (in the
65 example, it would be installed as foo.service).
66
67 Furthermore, if no unit files are passed explicitly as command line
68 arguments, dh_installsystemd will only act on unit files called
69 name (rather than all unit files found in the package).
70
71 --restart-after-upgrade
72 Do not stop the unit file until after the package upgrade has been
73 completed. This is the default behaviour in compat 10.
74
75 In earlier compat levels the default was to stop the unit file in
76 the prerm, and start it again in the postinst.
77
78 This can be useful for daemons that should not have a possibly long
79 downtime during upgrade. But you should make sure that the daemon
80 will not get confused by the package being upgraded while it's
81 running before using this option.
82
83 --no-restart-after-upgrade
84 Undo a previous --restart-after-upgrade (or the default of compat
85 10). If no other options are given, this will cause the service to
86 be stopped in the prerm script and started again in the postinst
87 script.
88
89 -r, --no-stop-on-upgrade, --no-restart-on-upgrade
90 Do not stop service on upgrade. This has the side-effect of not
91 restarting the service as a part of the upgrade.
92
93 If you want to restart the service with minimal downtime, please
94 use --restart-after-upgrade (default in compat 10 or later). If
95 you want the service to be restarted but be stopped during the
96 upgrade, then please use --no-restart-after-upgrade (note the
97 "after-upgrade").
98
99 Note that the --no-restart-on-upgrade alias is deprecated and will
100 be removed in compat 14. This is to avoid confusion with the
101 --no-restart-after-upgrade option.
102
103 --no-start
104 Do not start the unit file after upgrades and after initial
105 installation (the latter is only relevant for services without a
106 corresponding init script).
107
108 Note that this option does not affect whether the services are
109 enabled. Please remember to also use --no-enable if the services
110 should not be enabled.
111
112 unit file ...
113 Only process and generate maintscripts for the installed unit files
114 with the (base)name unit file.
115
116 Note: dh_installsystemd will still install unit files from debian/
117 but it will not generate any maintscripts for them unless they are
118 explicitly listed in unit file ...
119
121 This command is not idempotent. dh_prep(1) should be called between
122 invocations of this command (with the same arguments). Otherwise, it
123 may cause multiple instances of the same text to be added to maintainer
124 scripts.
125
127 debhelper(7), dh_installinit(1), deb-systemd-helper(1)
128
130 pkg-systemd-maintainers@lists.alioth.debian.org
131
132
133
13413.11.4 2023-01-22 DH_INSTALLSYSTEMD(1)