在规范步骤中以编程方式失败的RPM安装 [英] Failing an RPM install programmatically in a spec step

查看:79
本文介绍了在规范步骤中以编程方式失败的RPM安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作RPM.这个特定的RPM具有不能表示为RPM前提条件的要求,因此可以将它们称为特定的文件系统/磁盘配置.目前,失败是在安装后,运行时未满足要求的情况下发生的.

I'm making an RPM. This particular RPM has requirements that can't be expressed as RPM prerequisites, lets call them a particular filesystem/disk configuration. Currently the failure happens after install, at runtime, when the requirements aren't met.

我可以在脚本的%install,部分中检查所需的先决条件.但是,如果满足某些条件,我无法弄清楚如何使安装失败.是否可以通过%install(或其他)部分中的某些触发器在运行时使rpm安装失败?

I can check for the required prerequisites in the %install, section of my script. However, I can't figure out how to fail the install if certain criteria are met. Is it possible to fail an rpm install at runtime via some trigger in the %install (or some other) section?

在.spec文件中,示例如下所示:

An example would look something like so, in a .spec file:

%install
if [ -f /some/file ]
then
    FAIL_RPM_INSTALL ## What is this command?
fi

推荐答案

事实证明,如果退出%pre阶段,则rpm安装将失败.

It turns out that if you exit in the %pre stage the rpm install will fail.

%pre
if [ -f /some/file ]
then
    echo "/some/file exists, it shouldn't"
    exit 1
fi

参考: https://fedoraproject.org/wiki/Packaging:ScriptletSnippets

这篇关于在规范步骤中以编程方式失败的RPM安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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