Hi guys,
I'm packing a third party software and this third party software is a tarball with a install.sh and other binaries.
For example:
$ tar xvzf myprogram.tar.gz $ cd myprogram $ ls bin1 bin2 install.sh
To install this software I just need to run (as root) install.sh and myprogram runs fine.
After finishing installation I have all the files installed as the following example:
/usr/bin/bin1 /usr/bin/bin2
What's the better way to install these files?
Do I need to run install.sh on the %install section inside myprogram.spec? Something like this:
%install sh install.sh
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
And one question just to confirm: do I need to list all bin* files inside %files in both case, right?
Thanks in advance.
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
packaging@lists.fedoraproject.org