tags:

views:

109

answers:

3

All,

How to recreate an rpm which is already installed on a system on linux.

Thanks....

A: 

Basically you will have to do the following:

1] Create a .spec file with all the headers [ http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html ]

You will have to use the rpm -q --queryformat "" to get the header from the already installed rpm. Eg. rpm -q --queryformat "Release: %{RELEASE}\n" installed_rpm

For getting the files to fill the %files Section use the rpm -ql command.

2] run rpmbuild -bb specfile to generate the rpm file.

Gautam Borad
There is a option of recreating it.I was thinking something like that
Hulk
AFAIK there is no such option. But if you find one please let me know also.
Gautam Borad
A: 

Best way to recreate an RPM, is to do it from the source RPM. Great tutorial here.

JadziaMD
+2  A: 

What version of RPM are you using? If you're using a newer one, I have a trick that might work for you.

Newer versions of RPM have a transaction safe rollback option; simply use the --repackage command, and it'll generate a package that includes all the idiosyncratic crap of the original install. Mind you, you'll have to actually DO something (e.g rpm -e --repackage rpm_goes_here which will ERASE the original, while making a package which you SHOULD be able to restore (after you've made a copy), but if you expect this to work perfectly, I have a BRIDGE you might want to buy), so it's a bit of a leap of faith if you don't have a full backup.

There is some configuration involved, and you need to test test test before you try this on something critical, but this may work.

Satanicpuppy