[Mageia-dev] Adding tmpfiles.d support to packages
Colin Guthrie
mageia at colin.guthr.ie
Sun Nov 25 21:55:16 CET 2012
'Twas brillig, and Remco Rijnders at 25/11/12 12:44 did gyre and gimble:
> On Thu, Nov 22, 2012 at 10:20:21AM +0000, Colin wrote in
> <50ADFC65.8080905 at colin.guthr.ie>:
>> I should write up a wiki page, but here is the details:
>
> <snip>
>
>> # create tmpfiles directory
>> install -d -m0755 %{buildroot}%{_prefix}/lib/tmpfiles.d
>> install -m0644 %{SOURCEN}
>> %{buildroot}%{_prefix}/lib/tmpfiles.d/%{name}.conf
>>
>> Make sure it's included in the %files section too:
>> %{_prefix}/lib/tmpfiles.d/*.conf
>
> Hi Colin,
>
> Thanks for these instructions. I've updated fail2ban accordingly and am
> now in the process of doing inn.
Awesome thanks :)
> Running rpmlint on the spec file I did
> find that it results in some warnings when following your instructions
> to the letter:
>
> ./inn.spec:204: W: hardcoded-library-path in %{_prefix}/lib/tmpfiles.d
>
> ./inn.spec:205: W: hardcoded-library-path in
> %{_prefix}/lib/tmpfiles.d/%{name}.conf
>
> ./inn.spec:333: W: hardcoded-library-path in
> %{_prefix}/lib/tmpfiles.d/*.conf
Today I've spend some time on this and added a few helper macros.
You can now use:
%{_tmpfilesdir} in place of %{_prefix}/lib/tmpfiles.d
You can also use:
%_tmpfilescreate %{name}
rather than
systemd-tmpfiles --create %{name}.conf
That'll likely help keep things simpler and avoid a warning or two :)
Oh and you can also just do:
install -D -p -m 0644 %{SOURCEN} %{buildroot}%{_tmpfilesdir}/%{name}.conf
Rather than creating the folder separately (the -D argument does this
for you). -p isn't important but just preserves the timestamp of the
source file which is mainly cosmetic.
Col
--
Colin Guthrie
colin(at)mageia.org
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 Mageia-dev
mailing list