如果 SPEC 文件脚本的 %pre 部分 return false,如何回滚 RPM 安装
How to roll back RPM installation if %pre section of SPEC file script return false
我是 RPM 构建的新手。我必须构建 RPM,只有当文件 /etc/i-am-a-requirement 存在于目标机器上时才会安装包。所以我写了
%pre
if test -f "/etc/i-am-a-requirement"; then
echo "I'm OK to continue"
else
echo "The file is not found, the RPM won't be installed"
-- How to add failure here? --
fi
我知道通常我们希望 RPM 有依赖包,但在这种情况下“/etc/i-am-a-requirement”是作为二进制分发的,所以它根本没有包。
%pre
、%post
等脚本无法停止rpm的安装。一旦你进入小脚本;无论您的脚本的退出代码如何,安装都将继续。
你应该使用 要求:
Requires: /etc/i-am-a-requirement
我是 RPM 构建的新手。我必须构建 RPM,只有当文件 /etc/i-am-a-requirement 存在于目标机器上时才会安装包。所以我写了
%pre
if test -f "/etc/i-am-a-requirement"; then
echo "I'm OK to continue"
else
echo "The file is not found, the RPM won't be installed"
-- How to add failure here? --
fi
我知道通常我们希望 RPM 有依赖包,但在这种情况下“/etc/i-am-a-requirement”是作为二进制分发的,所以它根本没有包。
%pre
、%post
等脚本无法停止rpm的安装。一旦你进入小脚本;无论您的脚本的退出代码如何,安装都将继续。
你应该使用 要求:
Requires: /etc/i-am-a-requirement