gpt4 book ai didi

fedora - 在规范步骤中以编程方式安装 RPM 失败

转载 作者:行者123 更新时间:2023-12-02 17:35:06 29 4
gpt4 key购买 nike

我正在制定 RPM。这个特定的 RPM 具有无法表示为 RPM 先决条件的要求,我们将它们称为特定的文件系统/磁盘配置。目前,当不满足要求时,安装后、运行时会发生故障。

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

.spec 文件中的示例如下所示:

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

最佳答案

事实证明,如果您在 %pre 阶段退出,rpm 安装将会失败。

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

引用:https://fedoraproject.org/wiki/Packaging:ScriptletSnippets

关于fedora - 在规范步骤中以编程方式安装 RPM 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4037410/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com