[Fedora-packaging] The better way to use %install section
Tom "spot" Callaway
tcallawa at redhat.com
Tue Jun 9 01:20:23 UTC 2009
On 06/08/2009 07:33 PM, Murilo Opsfelder Araújo wrote:
> Hi guys,
>
> I'm packing a third party software and this third party software is a
> tarball with a install.sh and other binaries.
Well, this is a bit off topic for this list, but I'm in a good mood, so
I'll try to answer your questions.
> What's the better way to install these files?
The problem with the install.sh is that it almost certainly has the
install directories for those binaries hardcoded to /usr/bin. When
you're installing files during %install in an rpm, you want to install
those files into %{buildroot}%{_bindir}.
> Or do I need to copy all install.sh commands inside %install section?
> Something like this:
>
> %install
> install -o root -w root -m 0755 bin1 %{_installdir}/bin1
> install -o root -w root -m 0755 bin2 %{_installdir}/bin2
So, yes, you need to do something like this:
install -m 0755 bin1 %{buildroot}/%{_bindir}
install -m 0755 bin2 %{buildroot}/%{_bindir}
Make sure you have "BuildRoot:" defined in the top section of the spec
file, see:
https://fedoraproject.org/wiki/Packaging/Guidelines#BuildRoot_tag for
some recommended values.
Also, %{_bindir} evaluates to /usr/bin, so it's the ideal macro to use
here with the %{buildroot} prefix.
> And one question just to confirm: do I need to list all bin* files
> inside %files in both case, right?
Yes, you can do it like this:
%files
%defattr(-,root,root,-)
%{_bindir}/bin*
Hope that helps,
~spot
More information about the Fedora-packaging
mailing list