Have you ever had an RPM installed on the system that you needed installed on another system, but didn’t have the .rpm file for it? Or, have you wanted to make a .rpm file with just a minor change without having to completely rebuilt it? Or perhaps forge an RPM with some naughty scripts or binaries in it?
Check out my rpm-repack script. Simply run it with the package name that’s installed on the system:
$ ./rpm-repack wget Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.91066 <snip> Wrote: ~/rpmbuild/SRPMS/wget-1.11.4-2.el5_4.1.nosrc.rpm Wrote: ~/rpmbuild/RPMS/i386/wget-1.11.4-2.el5_4.1.i386.rpm
It requires you have an rpmbuild environment set up, but that’s about it. Run it, and you’ll get the .rpm file which is essentially all the files on your system related to that RPM, and a .nosrc.rpm so you can see how it was made.
It’s not full proof – it’s not meant to be – and it can’t do things like copy the RPM signature, due to the cryptography involved. But it does its job for what I wrote it for, and now you can use it too.