代码之家  ›  专栏  ›  技术社区  ›  Paul Rubel

在spec步骤中以编程方式安装RPM失败

  •  11
  • Paul Rubel  · 技术社区  · 15 年前

    我每分钟转数。这个特定的RPM具有不能表示为RPM先决条件的需求,让我们称之为特定的文件系统/磁盘配置。当前故障发生在安装之后,运行时,如果不满足要求。

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

    在.spec文件中,一个示例看起来是这样的:

    %install
    if [ -f /some/file ]
    then
        FAIL_RPM_INSTALL ## What is this command?
    fi
    
    2 回复  |  直到 9 年前
        1
  •  16
  •   Thomas Perl    11 年前

    结果是如果你在 %pre 准备转速安装失败。

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

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

        2
  •  2
  •   bbaassssiiee    13 年前
    %pre
    df /data|awk 'END{if ($2 < 10000000) exit 1;}'; 
    if [ $? == 1 ]; 
        then echo ERROR not enough space;exit 1;
    fi