[systemd-devel] runtime directories for services vs. tmpfiles

Lennart Poettering lennart at poettering.net
Tue Jul 16 09:01:17 PDT 2013

On Tue, 16.07.13 16:50, Colin Guthrie (gmane at colin.guthr.ie) wrote:

> 3. Finally I settled on:
> %_tmpfilesdir /usr/lib/tmpfiles.d
> %_tmpfilescreate() /usr/bin/systemd-tmpfiles --create %{1}.conf \
> %{nil}

This looks pretty close to what I'd like to see in place. Note that
%_tmpfilesdir is already set in macros.systemd as we ship it upstream.

My suggestion would be this however:

_tmpfiles_create() \
/usr/bin/systemd-tmpfiles --create %{1} >/dev/null 2>&1 || : \

I thik that people should specify file names rather than package names
(just to keep this closer to the underlying command and to make the
multiple drop-in case less exotic, and since we require the suffixe for
the unit macros too) and ignore errors. Also, add an underscore since
our other macros use the same naming style.

> In spec files I just put "%_tmpfilescreate %{name}" in %post in 99% of
> cases and a custom basename for when the file name does not match the
> package name in some rare cases.
> I'm sure the macro could be tweaked to put %{name} in magically if no
> argument is supplied..

Hmm, I'd like such an automatism, but I'd really prefer if we could come
up with some scheme to automatically determine all tmpfiles snippets in
the package and apply them all automatically. But I am not sure how that
could be done with current RPM.

In fact, I'd actually like to do the same for the %systemd_post macros,
and suchlike, where people tend to be pretty bad at always listing all
unit files correctly.

Anyway, does that RPM macro sound good to you? If so, let's add this to
macros.systemd and I'll ask our Fedora guys to add this to the


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list