如何在安装过时另一个 RPM 的 RPM 时检测升级

人气:617 发布:2022-10-16 标签: centos redhat fedora rpm rpm-spec

问题描述

RPM scriptlet 在 $1 中传递(此名称的软件包将在操作完成时留在系统上),以便他们可以确定是否正在进行软件包升级或删除.由于我无法控制的原因,我相信该软件包的下一个版本可能与第一个版本具有不同的软件包名称.我尝试创建一个 "obsoletes" 旧包的新包一个并使用它进行升级.但是,旧包 postun scriptlet 仍然得到 $1 == 0 并且我的 postun 清理脚本运行.

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.

这有点边缘情况,因为从技术上讲,还有 0 个具有该名称的软件包,但我认为过时的情况可能会假装在升级过程中仍有一个具有该名称的软件包.有没有办法测试包被废弃时的情况,以便脚本可以确定正在升级而不是删除包?

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?

推荐答案

你可以试试这个命令检查操作系统中的rpm包吗

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

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

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

861