2

I have following issue:

I have access only to binary file. From a binary file I am trying to make a full automated .deb package. I packaged it and works except the service file.

I created service file under debian folder

hello
-- hello
-- debian/hello.service

my rules file looks as below

$ cat debian/rules

    #!/usr/bin/make -f

    %:  
             dh $@
    override_dh:install:
            dh_install hello usr/bin

package is creating but it doesn't started service as well as not create service file under /etc/systemd/system/.

postinst file as below #!/bin/bash set -e

if [ $1 = configure] || [$1 = abort-upgrade]; then
    if [ -x /etc/init.d/hello ]; then
        update-rc.d hello defaults >/dev/null

1 Answer 1

3

You need to invoke the appropriate systemd service helpers (dh_installsystemd in compatibility level 12).

The simplest way to go about all this is to rely on dh sequences; it will do the right thing, even when there’s nothing to build:

#!/usr/bin/make -f

%:
        dh $@

override_dh_install:
        dh_install hello usr/bin

This will ensure that all the other helpers are run as appropriate in the sequence, including the systemd helpers.

With debhelper compatibility levels less than 10, you’ll need to enable the systemd sequence explicitly:

%:
        dh $@ --with systemd

(The service file will end up in /lib/systemd/system, not /etc/systemd/system.)

You could even drop the override altogether, if you write

hello usr/bin

into debian/install (or debian/hello.install, assuming your package is named hello).

7
  • my package is called hello and my binary also called hello. Yes hello.service file is created by the system under the path you said, but the app doesn't start still automatically,
    – celcin
    Commented Dec 12, 2019 at 10:26
  • I didnot set any version of -dh, what you mean exactly ?
    – celcin
    Commented Dec 12, 2019 at 10:49
  • What I mean is, did you replace your debian/rules with the short version in my answer, or did you keep your existing debian/rules and add dh_installsystemd to it? Commented Dec 12, 2019 at 11:01
  • I tested again, no success. see rule file ^ added to question
    – celcin
    Commented Dec 12, 2019 at 11:50
  • What version of Debian are you building on? What debhelper compatibility level are you using? Commented Dec 12, 2019 at 12:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .