Web lists-archives.com

Re: Questions about packaging systemd unit files

Theodore Y. Ts'o:
> On Sun, Aug 05, 2018 at 10:20:38PM +0100, Simon McVittie wrote:
>> On Sun, 05 Aug 2018 at 16:52:46 -0400, Theodore Y. Ts'o wrote:
>>> 1) Am I right in understanding that after modifying or adding any
>>>    systemd unit or timer files, I must run "systemctl daemon-reload"?
>> Yes, but preferably via dh_installinit (if you also have a corresponding
>> LSB/sysvinit script, like most daemons) or dh_installsystemd (if not,
>> like e.g. systemd-cron or quake4-server) rather than directly.
> There's a comment in the dh_installinit man page:
>   dh_installinit is a debhelper program that is responsible for
>   installing init scripts with associated defaults files.  In
>   compatibility levels up to 11, dh_installinit also handled upstart
>   job files and systemd service files.
> I realize that compat level 11 is the recommended, and since level 12
> is still open for development, but it sounds like in the future level
> 12 isn't going to do automatically handle init scripts automatically?

In compat 12, dh_installinit scripts will working with upstart files and
systemd services files.  Actually, I thought it stopped with systemd
units files in compat 11 - I would have to check up on that.

Feel free to file a bug against debhelper proposing a better / less
confusing way to document this.

> One of the reasons why I hadn't considered using dh_installinit or
> dh_installsystemd is because the patches submitted upstream for
> e2scrub[1] currently install the systemd unit as part of Makefile
> rules. [...]

Ben replied to this and is correct in that dh_installsystemd will look
for systemd units installed directly and setup maintscripts for them as

> Also, for a package which is either essential or required, using
> debhelper commands in the maintainer scripts would mean adding a
> dependency, which would mean what is currently an "optional" package
> would end up getting dragged in automatically.  Is this acceptable?  I
> would think it might be considered undesirable.

The debhelper generated maintscripts do *not* rely on anything from
debhelper itself.  In particularly, all commands used in the snippet
generated by dh_installsystemd is provided by "Essential: yes" packages,
so there is no problem here.