Consider the following in a SPEC file:
%files
%defattr(-,bubba,users,-)
...
%attr(-,root,users) %{_localstatedir}/foo/
%config %attr(-,root,root) %{_localstatedir}/foo/blah.crap
I want to include all files under foo
but also specifically mark blah.crap
as a config file (and its permissions may not match foo
's). Doing this causes rpmbuild to complain that the file is listed twice.
I tried to add the following between the last two lines above:
%exclude %{_localstatedir}/foo/blah.crap
However, this seems to permanently override any other inclusion, because, despite the fact that the next %config
line ought to include the file (now as a config file), blah.crap
does not get installed when I install the RPM.
So what's the right way to do this? Just ignoring the warning from rpmbuild is a BS answer, as is "just make a list of all files in foo
instead of listing the whole directory".
The best solution is to create a file manifest using find(1) in %install and used sed(1) to add %config or otherwise filter the manifest to taste.