How to have dh_installinit create the systemd-tmpfiles snippet for systemd-only packages?

Patrick Schleizer patrick-mailinglists at whonix.org
Wed Aug 12 18:21:25 BST 2015


Hi!

I would like to have the following debhelper auto generated snippet in
the maintainer script.

# Automatically added by dh_installinit
# In case this system is running systemd, we need to ensure that all
# necessary tmpfiles (if any) are created before starting.
if [ -d /run/systemd/system ] ; then
	systemd-tmpfiles --create /usr/lib/tmpfiles.d/sdwdate.conf >/dev/null
|| true
fi
# End automatically added section

Attempt (1):
Let's suppose that upstream's "make install" ships installs
usr/lib/tmpfiles.d/sdwdate.conf to /usr/lib/tmpfiles.d/sdwdate.conf.
That is rightly processed by dh_auto_install and rightly landing in
/usr/lib/tmpfiles.d/sdwdate.conf by the installed package.

debhelper / dh_installinit does not notice that. Adds no snippet to the
maintainer script. Is this a missing feature or am I using it wrong?

Attempt (2):
A file debian/sdwdate.tmpfile however would be picked up by
dh_installinit and rightly land in /usr/lib/tmpfiles.d/sdwdate.conf.
However, also no snippet will be added to the maintainer script. Is this
a missing feature or am I using it wrong?

Attempt (3):
So I tried adding to debian/rules:

override_dh_installinit:
	dh_installinit --onlyscripts

Better. The wanted snippet has been added. But another unwanted snippet
has also been added.

# Automatically added by dh_installinit
if [ -x "/etc/init.d/sdwdate" ]; then
	update-rc.d sdwdate defaults >/dev/null
	invoke-rc.d sdwdate start || exit $?
fi
# End automatically added section

This leads to lintian warnings. (init.d-script-not-included-in-package;
init.d-script-not-marked-as-conffile)

It seems like dh_installinit doesn't play nice with 'systemd-only
packages' + 'create systemd-tmpfiles' snippet?

(We really would like to avoid maintaining sysvinit scripts, because we
don't use them.)

Are these known issues or am I just using it wrong?

Cheers,
Patrick

https://github.com/troubadoour/sdwdate/tree/python



More information about the Pkg-systemd-maintainers mailing list