[Pkg-systemd-maintainers] How to add systemd unit files for inetd-like services?

Michael Stapelberg stapelberg at debian.org
Fri Aug 2 18:10:12 BST 2013


Hi Moritz,

many thanks for your interest in systemd and for contacting us!

Moritz Mühlenhoff <jmm at inutil.org> writes:
> I researched/wrote up two service files and put them into
> /etc/systemd/system:
I assume you know this already, but let’s just state it again: when you
actually want to ship the files in a Debian package, /etc/systemd/system
is _not_ the path they should go into :). /lib/systemd/system is the
only path that packages should touch.

> leafnode.socket:
> [Unit]
> Description=NNTP server for small sites (socket)
Consider adding Documentation=man:leafnode(1) so that the manpage is
referenced in e.g. systemctl status :).

> These two work very well in my tests. Can you advise on the correct way to hook 
> these into a package using dh-systemd ?
Yep, the unit files look fine. Given that we currently don’t support
shipping a .socket file by just putting it into debian/$package.socket,
you will need to manually put these files in place before calling
dh_systemd_enable in debian/rules:

        dh_installcron
        mkdir -p debian/leafnode/lib/systemd/system
        cp debian/leafnode.socket
        debian/leafnode/lib/systemd/system/leafnode.socket
        cp debian/leafnode at .service
        debian/leafnode/lib/systemd/system/leafnode at .service
        dh_systemd_enable
        dh_systemd_start
        dh_installchangelogs

That generates maintscripts which look correct on first glance, but I
have not actually tested whether it works properly. Feedback welcome!

To make shipping socket files easier in the future I created a bugreport
where you can track progress on that feature:
http://bugs.debian.org/718592

-- 
Best regards,
Michael




More information about the Pkg-systemd-maintainers mailing list