Is it possible to modify/rebuild an rpm without the srpm?
I have an rpm for which I need to change the preinstal scriptlet for testing.
However, I do not have the SRPM from which is was built.
Is it possible to change the scriptlet and/or rebuild the rpm without having the SRPM?
If so, how?
I've tried using Midnight Commander (mc
) to open the rpm as a directory structure and edit the contents, but even with 666
permissions, it won't let me save any changes.
What is needed is rpmrebuild, which I found via the Red Hat Magazine article.
If you have an rpm for which you only wish to modify the spec file, do the following:
- copy the rpm in question to a working directory
- run
rpmrebuild -e -p <pkg>rpm
(this will open your default editor (typicallyvi|vim
if you haven't made any changes on your rpm-based distro), allowing you to make changes to the spec file) - find the line(s) you wish to change
- make changes
- save and exit your editor (Esc:wq! in
vi[m]
, Ctrl-x s inemacs
) -
rpmrebuild
will ask if you want to continue - answer 'yes'
- the rebuilt package will show up in
/usr/src/redhat/RPMS/<arch>/<pkg>.rpm