8

I'm new to Debian packaging and I believe this is a fairly basic question, but I am embarrassed to say I've struck out on Google.

I have a C++ project which builds with CMake and packages a debian with CPack. This project has a service component (systemd style). My goal is to have the service enabled & auto-started upon installation of the package.

My research has yielded two approaches:

1) Run various systemctl commands inside the {pre,post}{inst,rm} scripts in the Debian. Care is required to handle install, remove, and upgrade scenarios properly.

2) Simply put the project.service inside the debian directory and let debhelper (with dh_systemd_enable) handle service installation and start 'automagically'.

Option #2 is obviously preferred because the {pre,post}{inst,rm} is very manual and thus error-prone, but I cannot figure out whether there's a well supported way to leverage debhelper from within CPack.

The Question: I'd like to avoid rewriting the debian packaging stuff in my project's CMake as it's been around for some time and works well. The relationship (if any) between CPackDeb and debhelper is not clear to me -- can CPack take advantage of the dh_systemd_enable features or must I manage the service manually in {pre,post}{inst,rm} scripts?

Sean Kelly
  • 338
  • 1
  • 10

0 Answers0