dh-systemd seems not to support multiple service units

Felipe Sateler fsateler at debian.org
Mon Feb 13 12:52:34 GMT 2017


Hi Dererk,

On 10 February 2017 at 14:06, Dererk <dererk at debian.org> wrote:
> Dear pkg-systemd Maintainers,
>
> I've been trying to deliver a package that has a mix of enabled/disable
> and started/not started service units.
>
> The situation I encounter seems to be reflected at the manpage, when
> calling dh_systemd_enable, quoting:
>
> "Note that this command is not idempotent. dh_prep(1) should be called
> between invocations of this command (with the same arguments).
> Otherwise, it may cause multiple instances of the same text to be added
> to maintainer scripts"
>
> Which is exactly what I end up with, a really long postinst file
> repeating the postinst instructions generated in the previous
> dh_systemd_enable call
>
> On the other hand, I may not be properly understanding the reference in
> the manpage that states to trigger dh_prep between dh_system. If I
> understand correctly, dh_prep will actually remove everything writing up
> to that point into the respective debian/ directory's package entry,
> which I double checked it does:
>
> dh_prep --name=service_on_by_default
>     rm -f debian/python3-mypackage.substvars
>     rm -f debian/python3-mypackage.*.debhelper
>     rm -rf debian/python3-mypackage/
>     rm -f debian/binaries-pkg.substvars
>     rm -f debian/binaries-pkg.*.debhelper
>     rm -rf debian/binaries-pkg/
>     rm -rf debian/tmp
>
> What am I doing wrong? This is what the debian/rules looks like:
>
> override_dh_systemd_enable:
>     dh_systemd_enable --name=service_on_by_default
>     dh_prep --name=service_on_by_default
>
>     dh_systemd_enable --no-enable --name=non_tipical_service

Do not invoke dh_prep here. The manpage warning refers to invocations
using the same arguments. In your case they are not the same
arguments, so you should not call dh_prep.

The warning just implies that running the
override_dh_systemd_enable[1] target multiple times will result in
maintainer scripts that repeat themselves.


[1] or equivalent for other sequencers.

-- 

Saludos,
Felipe Sateler




More information about the Pkg-systemd-maintainers mailing list