Hi Michael and Luca
Is this a bug you have an opinion on?
Best regards,
Niels
Daniel Carpenter:
Package: debhelper
Version: 13.11.4
If I include this static (i.e. no [Install] section) systemd service:
# debian/debhelper-example.service
[Service]
Type=oneshot
ExecStart=true
then dh_installsystemd will insert this snippet in postinst:
if [ -n "$2" ]; then
_dh_action=restart
else
_dh_action=start
fi
deb-systemd-invoke $_dh_action 'debhelper-example.service' >/dev/null ||
true
When I install the package, deb-systemd-invoke issues a warning:
debhelper-example.service is a disabled or a static unit, not starting it.
Indeed, such a unit should not be started on package installation (but
rather by a path, socket or timer unit). I notice that dh_installsystemd
produces another snippet which enables the unit if it contains an [Install]
section. I think both snippets should be omitted for static units.
On upgrades, the restart part makes more sense, but for type=oneshot I
think that's only relevant if RemainAfterExit=true.
As a workaround, I can write:
override_dh_installsystemd:
dh_installsystemd --no-start
in debian/rules, but that prevents any units from being started, not just
the static ones. I assume you have to list the static units with
--no-start, and the others without it, but that's more error prone than
letting debhelper handle it.