It also finds the service files installed by a package and generates preinst, postinst, and prerm code blocks for enabling, disabling, starting, stopping, and restarting the corresponding systemd services, when the package is installed, updated, or removed. These snippets are added to the maintainer scripts by dh_installdeb(1).
deb-systemd-helper(1) is used to enable and disable systemd units, thus it is not necessary that the machine actually runs systemd during package installation time, enabling happens on all machines in order to be able to switch from sysvinit to systemd and back.
dh_installsystemd operates on all unit files installed by a package. For only generating blocks for specific unit files, pass them as arguments, "dh_installsystemd quota.service". Specific unit files can be excluded from processing using the -X common debhelper(1) option.
Note that this option does not affect whether the services are started. Please remember to also use --no-start if the service should not be started.
It changes the name that dh_installsystemd uses when it looks for maintainer provided systemd unit files as listed in the ``FILES'' section. As an example, dh_installsystemd --name foo will look for debian/package.foo.service instead of debian/package.service). These unit files are installed as name.unit-extension (in the example, it would be installed as foo.service).
Furthermore, if no unit files are passed explicitly as command line arguments, dh_installsystemd will only act on unit files called name (rather than all unit files found in the package).
In earlier compat levels the default was to stop the unit file in the prerm, and start it again in the postinst.
This can be useful for daemons that should not have a possibly long downtime during upgrade. But you should make sure that the daemon will not get confused by the package being upgraded while it's running before using this option.
Note that this option does not affect whether the services are enabled. Please remember to also use --no-enable if the services should not be enabled.
Note: dh_installsystemd will still install unit files from debian/ but it will not generate any maintscripts for them unless they are explicitly listed in unit file ...