出现错误时如何退出rpm安装 [英] How to exit rpm install in case of an error

查看:133
本文介绍了出现错误时如何退出rpm安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果某些条件为假,我正在寻找一种退出 rpm 安装的方法.我在 %pre 部分添加了一个小脚本,如果我的条件失败,它会退出安装.

I am looking for a way to exit rpm install if some condition is false. I have added a small script in the %pre section that exits install if my condition fails.

我面临的问题是我看到 %pre scriptlet 被执行,并且 rpm 安装失败.然而,在它的最后,我得到了这 2 行我不想要的 -- Installed ... 其次是 Complete!

The problem I am facing is I see that the %pre scriptlet is executed, and rpm install does fail. Yet at the end of it I get these 2 lines which I don't want -- Installed ... followed by Complete!

Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
missing file zyWhg1. exiting install..
error: %pre(tyr-3.2.1.x86_64) scriptlet failed, exit status 255
error:   install: %pre scriptlet failed (2), skipping tyr-3.2.1

Installed: tyr-3.2.1.x86_64 0:3.2.1
Complete!

推荐答案

如果你需要这个只是为了确保文件系统中有某个文件,你可以做简单的

If you need this just to make sure there is certain file in the filesystem, you can do simple

Requires: /path/to/expected/file

否则你可能真的不走运.

Otherwise you are indeed out of luck probably.

我可以想到非常丑陋的解决方案,包括从 scriptlet 中杀死 rpm,但那是万恶的 :-)

I could think of extremely ugly solution that would involve killing rpm from within scriptlet, but that is beyond evil :-)

这篇关于出现错误时如何退出rpm安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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