Search code examples
debianpackagingsystemd

Packaging systemd without start service on install


I package my software with dpgk and dh-make for create directory and files. I would like to add systemd support, so I installed dh-systemd.

But, after packaging, I try to install my package, the service is started. I would like to install my .deb without starting the service.

Here my debian/rules file:

%:
dh $@ --with=systemd
override_dh_installinit:
    dh_installinit --name=myapp --no-start

I follow this : https://manpages.debian.org/testing/debhelper/dh_installinit.1.en.html

I don't understand why the service start

Thanks ! :)


Solution

  • I got my similar case working by overriding dh_systemd_start so this should work for you:

    %:
        dh $@ --with=systemd
    
    override_dh_installinit:
        dh_installinit --name=myapp
    
    override_dh_systemd_start:
        dh_systemd_start --no-start
    

    Remember that this will also not stop the service on removal as mentioned in the --no-start doc.