I would like to create one single RPM package that depending on the architecture of the system that is installed (i.e. i386 or x86_64), it installs platform-specific files.
For example, I have some configuration files only (no compiling required) that I want to package. If the RPM would be installed on x86, the files would go under /usr/lib ; if the RPM would be installed on x86_64, the files would go under /usr/lib64.
Currently, I have in the …/SOURCES directory the following structure:
foo_rpm/
foo_rpm/usr
foo_rpm/usr/lib
foo_rpm/usr/lib64
foo_rpm/usr/lib/foo_config
foo_rpm/usr/lib64/foog_config
Is it possible to have just one RPM, that can handle this ? Meaning for example, could my RPM have all these files packaged, but when it’s installed on x86, it would only install:
/usr
/usr/lib
/usr/lib/foo_config
In the .spec file I have defined:
%files
%ifarch i386 i486 i586 i686
/usr/lib
%endif
%ifarch x86_64
/usr/lib64
%endif
However, I realized that this applies only at the build time.
When I run
rpmbuild -ba --target=i586 ./foo_rpm.spec
it creates a foo_rpm.i586.rpm package.
Then I have to run once more
rpmbuild -ba --target=x86_64 ./foo_rpm.spec
to create a foo_rpm.x86_64.rpm package.
Would be nice if a single foo_rpm RPM package would contain all files for both architectures, but installs only the files applicable for the system it is being installed on.