RPM 升级卸载 RPM [英] RPM upgrade uninstalls the RPM

查看:62
本文介绍了RPM 升级卸载 RPM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在升级我们的项目 RPM.问题是当我从 projectname-1.0-0 升级到 projectname-1.0-1 时,它首先安装新项目并卸载旧项目,总的来说,这完全删除了我的项目.我在升级时使用了vv"选项,输出显示安装后已完成卸载.

I am upgrading our project RPM. The problem is when I upgrade from projectname-1.0-0 to projectname-1.0-1, it first installs the new project and uninstalls the old project, which, in overall view, removes my project entirely. I have used "vv" option while upgrading and the output showed the uninstallation is done after installation.

请有人帮忙解决这个问题.我应该在 RPM 规范或 rpmbuild 选项中特别更改什么吗?

Somebody please help with this problem. Is there anything I should change specifically in the RPM spec or rpmbuild options?

推荐答案

是的,当发生 RPM 升级时,RPM 首先安装新版本的包,然后卸载旧版本的包.仅删除旧包的文件.但是您的脚本(即 %pre、%post、%preun、%postun)需要知道它们是在处理升级还是只是简单的安装或卸载.

Yes, when an RPM upgrade occurs, RPM first installs the new version of the package and then uninstalls the old version of the package. Only the files of the old package are removed. But your scripts (i.e. %pre, %post, %preun, %postun) need to know whether they are handling an upgrade or just a plain install or uninstall.

rpm 命令将向您的脚本传递一个参数,即 $1,它是已安装软件包版本数的计数.下表(来自 Eric Foster-Johnston 的 RedHat RPM 指南)提供了可能值的示例.

The rpm command will pass one argument to your scripts, that is, $1, which is a count of the number of versions of the package that are installed. The table below (from the RedHat RPM Guide by Eric Foster-Johnston) provides a sample of possible values.

Install the first time:          1
Upgrade:                         2 or higher 
                                 (depending on the number of versions installed)
Remove last version of package:  0

因此,在您的 %preun 中,您可能想在删除任何服务之前检查$1 = 0".

So, in your %preun, you probably want to check if "$1 = 0" before removing any services.

有关更多信息(和更好的表格),请参阅:http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s04s05.html

For more information (and a better table) see: http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s04s05.html

这篇关于RPM 升级卸载 RPM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆