0

Description of the question:

  1. I made a rpm package which delete all the files on the uninstall.
  2. I want to make a rpm package which can handle the upgrade option also (-U)
  3. So I implement rpm spec file in such a way (on the basis of $1 value),

but as this implementation is not present in the installed release. The previous rpm deletes my all folders. I am thinking to edit the previous spec file. but not able to find the path of this spec file.

How can I solved this.

Thanks & Regards,

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
Deepak
  • 83
  • 1
  • 7

1 Answers1

2

That's not how this works. The previous spec file doesn't exist on the disk. The scriptlets it included are stored in the rpm database. You can't "edit" that.

You can prevent scripts from running by running rpm --noscripts -e <package> but you don't want to do that during the ugprade or when removing any other packages.

I assume your package is removing files in %post. If they aren't files that you can easily recreate/etc. then your only option here is to copy all the files in %pre and then restore them all in a special trigger designed for this sort of emergency clean up.

From http://rpm.org/api/4.4.2.2/triggers.html:

There is one other type of trigger available -- triggerpostun. These are triggers that are run after their target package has been removed; they will never be run when the package containing the trigger is removed.

While this type of trigger is almost never useful, they allow a package to fix errors introduced by the postun of another package (or by an earlier version of that package).

You also don't need to manually remove any files your package installed normally (things listed in the %files section of your rpm and that rpm -qf <package> lists). rpm will remove those for your automatically when your package is removed (and install the new packages versions of files automatically during upgrade).

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148