How to detect upgrade when an RPM that obsoletes a

2019-05-05 03:55发布

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?

1条回答
倾城 Initia
2楼-- · 2019-05-05 04:20

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

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

查看更多
登录 后发表回答