Question

How do I recreate an rpm which is already installed on a system on linux?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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

The deltarpm package can do that:

A deltarpm contains the difference between an old and a new version of a rpm, which makes it possible to recreate the new rpm from the deltarpm and the old one. You don't have to have a copy of the old rpm, deltarpms can also work with installed rpms.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top