Example snippet of a SPEC file:
...
%install
unzip $RPM_SOURCE_DIR/APPLICATION-%{version}.zip -d %{buildroot}/
find %{buildroot} -type f ! -name "*.conf" | awk -F %{buildroot} '{print $2}' > filelist.txt
find %{buildroot} -type f -name "*.conf" | awk -F %{buildroot} '{print $2}' > configfilelist.txt
%files -f filelist.txt
...
For regular files I can use the -f option to load the list in the generated file:
%files -f filelist.txt
I want to apply the confilelist in a similar fashion.
%config(noreplace) xyz
Is there a way to do this?
Add a little
awk
string concatenation magic and this should work. The rationale is that you now only define a single file for%files -f
to parse. To make the single file, I used the shell redirect operator for append rather than force write.I swapped your order of instructions by defining configuration files first but that probably isn't necessary.
If you have docs you want to specify you should be able to do the same thing just with
{print "%doc", $2}
for theawk
print string.Great question, I'm all about these type of logical tricks because it becomes more ripe for CI/CD, less manual data entry, and longer lasting templates.