dh_installsystemd installing multiple services

Christopher Obbard chris at 64studio.com
Wed Jul 18 18:52:52 BST 2018


Hi everyone,

Hope you do not mind the noise as I am not sure exactly where to post this.

Currently I am packaging using debhelper compatibility level 10.

Looking to upgrade to level 11, the only thing stopping me is
installing of multiple services per package.

In the debian/control file, I currently have:    Build-Depends:
debhelper (>= 10), dh-systemd
but now I guess this can be just:   Build-Depends: debhelper (>= 11)


I have created <packagename>.<servicename>.service for each service,
for example debian/foo.bar.service and debian/foo.ham.service.

In debian/rules I have the following,

#!/usr/bin/make -f
%:
    dh $@ --with=systemd    # I guess I can now remove the --with=systemd


override_dh_installinit:
    dh_systemd_enable -pfoo --name=foo bar.service
    dh_systemd_enable -pfoo --name=ham ham.service
    dh_installinit -pfoo
    dh_installinit -pfoo --name=bar
    dh_installinit -pfoo --name=ham
    dh_systemd_start -pfoo bar.service --no-restart-on-upgrade
    dh_systemd_start -pfoo ham.service --no-restart-on-upgrade

and in debian/postinst I have:

deb-systemd-invoke enable bar
deb-systemd-invoke enable ham

With debhelper 11 I tried with a single service file called
foo.service and the following rules code, which seemed to work OK, but
didn't start the service on the next boot:

override_dh_installsystemd:
    dh_installsystemd foo.service


Any pointers would be greatly appreciated.

Cheers!

Chris



More information about the Pkg-systemd-maintainers mailing list