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

Colin Guthrie gmane at colin.guthr.ie
Tue Jul 16 08:50:13 PDT 2013


'Twas brillig, and Lennart Poettering at 16/07/13 16:00 did gyre and gimble:
> Something I'd love to see though is if we could make it easier to apply
> tmpfiles stuff automatically on package installation. More specifically,
> I'd like an RPM macro to be added that handles this, and which is
> sufficient for packagers to call for their tmpfiles. ALl in order to
> ensure that the user can invoke the services right after package
> installation without requiring a reboot.

I've gone around the block a few times on this.

1. We used file triggers (which we've supported for a while with various
patches to rpm but which think are only just now coming to fedora via
official support in upstream rpm - I forget the details tho', so could
be wrong), but this was a bad idea as these triggers ran too late after
%post. As %post might need these folders to start/restart the daemon, I
had to abandon that.

2. I used to recommend just running "systemd-tmpfiles --create" but this
meant that the /run/nologin file was created which meant you couldn't
login... ugg. Don't do that in any macro please :D

3. Finally I settled on:

%_tmpfilesdir /usr/lib/tmpfiles.d
%_tmpfilescreate() /usr/bin/systemd-tmpfiles --create %{1}.conf \
%{nil}


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..

HTHs (and if you have no preference as to the name, that you can use the
one I already use ;)

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list