Build bash 3.2 rpm package

Rick Stevens ricks at nerd.com
Fri Sep 24 01:02:48 UTC 2010


On 09/23/2010 04:00 PM, Sam Varshavchik wrote:
> Bruno Galindro da Costa writes:
>
>> Sam,
>> Â  Â Â  When you mean 'nuke all other files' what do you want to mean?
>> Delete all other files?
>> Â Â  If I download the source package (e.g. bash-3.2-24.el5.src.rpm
>> for Red Hat 5), install it, grab only the spec file and put it in
>> /usr/src/redhat/SPECS/ directory, put all other files in
>> /usr/src/redhat/SOURCES/ directory and try to do a rpmbuild -ba
>> /usr/src/redhat/SPECS/bash.spec, could it work?
>
> Yes. And you will end up with a perfectly valid bash rpm package.
>
> Unfortunately, you will not be able to install it. That's because the
> package will install /bin/bash, and you already have this file installed
> by your existing bash rpm. This is the fundamental function of rpm: to
> prevent different packages from installing conflicting files and
> overwriting each other.
>
> And not just /bin/bash, but also the corresponding man page, the locale
> files, and all other files that you seen when you run "rpm -q -l bash".
>
> That's why I told you that you need to modify the spec file so that the
> final bash binary gets installed as /bin/bash3, so as to not conflict
> with your existing bash interpreter, as well as remove all other files
> from your bash 3 rpm package, so that the only thing that your
> newly-built bash rpm would install is /bin/bash3.

If all he wants is the binary and source RPMS, don't bugger the spec
file to change the name.  Just specify the "--buildroot" option to
rpmbuild, e.g.:

	rpmbuild -ba --buildroot=/tmp/BUILDROOT --target=...

That will build the lot, but instead of installing the binaries and
such in the system directories before the binary RPMs are built,
they'll be put into /tmp/BUILDROOT.

When the RPMs are all built, /tmp/BUILDROOT will be deleted by
rpmbuild.  The resulting source RPM will show up in
"~/buildroot/SRPMS" and the binary RPMs (docs, debug, etc.) will be in
"~/buildroot/RPMS/(architecture)" (where "(architecture)" is "i386",
"x86_64", etc.).

No harm, no foul, no mucking up your live system.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, C2 Hosting          ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-         "If you can't fix it...duct tape it!"  -- Tim Allen        -
----------------------------------------------------------------------


More information about the users mailing list