【问题标题】:why does rpm reinstall executes %postun after %post section为什么 rpm 重新安装在 %post 部分之后执行 %postun
【发布时间】:2021-08-18 19:25:52
【问题描述】:

我有一个示例 rpm 规范文件,例如

Name:           helloworld
Version:        2.0
Release:        2%{?dist}
Summary:        Simple Hello World rpm
License:        Internal
Source0:        helloworld-src.tar.bz2

%description

%prep
%setup -c -q -T -D -a 0

%build

%install
echo "Install command ..."

%post
echo "post command..."

%postun
echo "postun command..."


%files
%doc
%changelog

当我执行rpm -i helloworld.rpm时,输出是

post command...

但是当我执行rpm --reinstall helloworld时,输出是

post command...
postun command...

为什么会这样?我期待在调用post 之前调用postun。 在哪里可以找到rpm --reinstall 期间将调用哪些脚本?

【问题讨论】:

    标签: rpm rhel rpm-spec


    【解决方案1】:

    这是因为重新安装就像升级;安装新的并卸载旧的,触发%postun。来自Fedora's excellent packaging guidelines 的完整序列显示您正在执行第 4 步和第 11 步:

    1. %pretrans 的新包
    2. %pre 新包
    3. (包安装)
    4. %post 新包
    5. %triggerin of other packages(通过安装新包触发)
    6. %triggerin of new package (如果有的话)
    7. %triggerun of old package (如果它是通过卸载旧包触发的)
    8. %triggerrun of other packages(通过卸载旧包触发)
    9. %preun 旧包
    10. (删除旧包)
    11. %postun 旧包
    12. %triggerpostun of old package (如果它是通过卸载旧包触发的)
    13. %triggerpostun 的其他包(如果它们是通过卸载旧包触发的)
    14. %posttrans 新包

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-22
      • 1970-01-01
      • 2011-11-14
      • 2011-09-01
      • 1970-01-01
      • 2016-09-11
      • 1970-01-01
      相关资源
      最近更新 更多