dh_installinit looks for debian/$(package).service, but a package may provide multiple services.

Is it possible for one to bundle multiples .service for one package with this method?


You can call dh_installinit multiple times with different --name parameters to install multiple services:

        dh_installinit --name=service1
        dh_installinit --name=service2

(or similar approaches if you're not using short dh style). If your source package builds multiple binary packages, you can add -p options to limit dh_installinit's action to the appropriate package.

  • @ Stephen Kitt How does this work with service files? The man page section for the --name option only mentions .upstart, .init & .default file types. --- Install the init script (and default file) as well as upstart job file using the filename name instead of the default filename, which is the package name. When this parameter is used, dh_installinit looks for and installs files named debian/package.name.init, debian/package.name.default and debian/package.name.upstart instead of the usual debian/package.init, debian/package.default and debian/package.upstart.
    – Wimateeka
    Feb 7 '18 at 18:50
  • 1
    @Wimateeka well spotted, the documentation is out of date there. --name is handled globally for all debhelper commands, by Debian::Debhelper::Dh_Getopt, ::Dh_Lib and ::Buildsystem; it works for all supported file types. See for example cups and glibc which both use dh_installinit with a --name argument to install systemd services. Feb 7 '18 at 21:24

Starting from compatibility level 11, dh_installinit no longer handles systemd services. Use dh_installsystemd instead:

    dh_installsystemd --name=service1
    dh_installsystemd --name=service2

(The above assumes that you have two service files: debian/<package-name>.service1.service and debian/<package-name>.service2.service.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.