Zack Bartel

Archive for the 'Linux' Category

Repackaging RPMs

July 26th, 2006 by Zack
Flomax No Prescription Cialis Soft Tabs For Sale Prednisone Generic Buy Lipitor Online Cialis Soft Tabs Without Prescription Erythromycin No Prescription Seroquel For Sale Aldactone Generic Buy Coumadin Online Prozac Without Prescription

Today at work I needed to effectively “unroll”, alter files and “repackage” a Fedora Core 5 (RedHat) RPM (RedHat package Manager) that was non-architecture specific. I wanted to alter some (most) of the files in a couple RPMs and repackage them so the RedHat installer (anaconda) could not tell the difference. It took a little research but I got it figured out. Here is a brief tutorial on how to accomplish this.

We’ll call the package in question pack-1.2-fc5-1.

Get the src rpm pack-1.2-fc5-1.src.rpm

Find the name of the .spec file:

rpm -pql pack-1.2-fc5-1.src.rpm

Extract the .spec file which is a configuration file that tells rpmbuild how to build the rpm file:

rpm2cpio pack-1.2-fc5-1.src.rpm | cpio -i pack.spec (or whatever the spec file is named)

Extract the archive inside the src rpm (typically pack-1.2-fc5-1.tar.bz2):

rpm2cpio pack-1.2-fc5-1.src.rpm | cpio -i –make-directories pack-1.2-fc5-1.tar.bz2

Unarchive the pack-1.2-fc5-1.tar.bz2 and make changes to the files in the directory pack-1.2-fc5-1

Change the necessary tags in the .spec file. In this case it was “Platform=noarch”

Repackage the zip file: (in this case)

tar cjvf pack-1.2-fc5-1.tar.bz2 pack-1.2-fc5-1

Move the newly created tar.bz2 file to /usr/src/redhat/SOURCE/ (or wherever your spec file is expecting it to be, with default fedora pacakges they all seem to point here).

To repackage the RPM:

rpmbuild -ba pack.spec (or whatever the spec file is named)

This will re-create a noarch.rpm in /usr/src/redhat/RPM/noarch that contains the changes to the files that you altered.

That’s it!

This is something that I thought would have been a common enough activity that it would be documented, but, surprisingly I had to dig a little to figure it out.

Why Do I Use Linux?

March 14th, 2006 by Zack