0

I am writing a spec file which creates multiple packages. Can I use a for loop over %files directive with different names, like this:

for name in {package1, package2, package3} ; do
  %files -n $name
  %attr(644, root, root) /etc/systemd/system/$name.service
done
TomTom
  • 141
  • 1
  • 4

2 Answers2

2

In long words due to minimal post length restriction: No.

Spec files are not any form of scripting language.

Sven
  • 97,248
  • 13
  • 177
  • 225
1

Spec file is not scripting language, you still can use your own script file to create file list and feed the list to spec file. From document "Directives For the %files list":

-f <file> — Read the %files List From <file>

The -f option is used to direct RPM to read the %files list from the named file. Like the %files list in a spec file, the file named using the -f option should contain one filename per line and also include any of the directives named in this section.

%files latex -f tetex-latex-skel

Here, the filenames present in the file tetex-latex-skel would be packaged.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940