rpmrpmbuildrpm-spec

rpmbuild: define directory as source file


Is it possible to define a directory with files in it as a source? I set the following in my .spec file:

...
Source0: file1
Source1: mydir/x1.txt
Source2: mydir/x2.txt
...

%install
install -D -m 0644 %{S:0} %{buildroot}%{_sbindir}/file1
install -D -m 0644 %{S:3} %{buildroot}%{_prefix}/local/etc/mydir/x1.txt
install -D -m 0644 %{S:4} %{buildroot}%{_prefix}/local/etc/mydir/x2.txt

%files
%{_sbindir}/file1
%{_prefix}/local/etc/mydir/x1.txt
%{_prefix}/local/etc/mydir/x2.txt
...

However rpmbuild fails:

install: cannot stat '/home/mrv/rpmbuild/SOURCES/x1.txt': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.NXmITb (%install)

Is there no way to tell rpmbuild that I want files from SOURCES/mydir/* ?


Solution

  • Nope; it must be a tarball / zip file / etc. This link walks you thru the steps to tar it up.