Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
    
444 permissions are just "everybody can read"; no write permissions there. you need 7 for read-write-execute -- 700 for you, 777 for everybody. – quack quixote Apr 21 '10 at 13:17
    
@quack quixote - I meant '666', fixing now – warren Apr 21 '10 at 13:40
    
yeah, 444 does look a lot ... less evil, doesn't it? :) – quack quixote Apr 21 '10 at 13:46
    
@quack quixote - it does indeed :) – warren Apr 21 '10 at 14:16
up vote 9 down vote accepted

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:

  1. copy the rpm in question to a working directory
  2. run rpmrebuild -e -p <pkg>rpm   (this will open your default editor (typically vi|vim if you haven't made any changes on your rpm-based distro), allowing you to make changes to the spec file)
  3. find the line(s) you wish to change
  4. make changes
  5. save and exit your editor   (Esc:wq! in vi[m], Ctrl-x s in emacs)
  6. rpmrebuild will ask if you want to continue
  7. answer 'yes'
  8. the rebuilt package will show up in /usr/src/redhat/RPMS/<arch>/<pkg>.rpm
share|improve this answer
    
and the downvote is for ...? – warren Mar 20 '15 at 2:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .