5

RPM scriptlets are passed in $1 ( the number of packages of this name which will be left on the system when the action completes ) so they can determine whether a package upgrade or removal is occurring. For reasons outside my control, I believe the next version of the package may have a different package name than the first version. I tried to create a new package that "obsoletes" the old one and upgraded using it. However, the old package postun scriptlet still got $1 == 0 and my postun cleanup script ran.

This is a bit of an edge case, because technically there are 0 packages with that name remaining, but I thought the obsoletes case might pretend that there's still a package with that name during the upgrade. Is there a way to test for the situation when a package is being obsoleted so that the scriptlet can determine an upgrade is occurring instead of a package removal?

Dan R
  • 198
  • 5
  • There are `0` copies of the old package though. It does seem to be a problem, but acting the way one would expect. – Aaron D. Marasco Jan 03 '18 at 22:39
  • Did you ever work around this issue? – Brad P. Feb 14 '18 at 17:45
  • In my case it turns out in my case the rpm upgrade feature won't be used. But it did occur to me that you could work around this by doing something like conditionally executing the cleanup script in the old package scriptlet if a "upgrade_is_ocurring" file isn't present which could be created by the new package, and deleted either by the old package in %postun or the new package in %posttrans – Dan R Feb 21 '18 at 00:44

1 Answers1

-2

Can you try this command to check the rpm packages in the OS

rpm -qa | grep -i "(RPMNAME)"

MKirat
  • 381
  • 4
  • 2