Menu Close

4.3.5. Triggers 指令

Triggers 是 RPM 指令,可提供在软件包安装和卸载期间交互的方法。

警告

Triggers 可能会在意外执行,例如在更新包含软件包时执行。很难调试 Triggers,因此需要以可靠的方式实施它们,以便在意外执行时不会中断任何操作。因此,红帽建议尽可能减少使用 Triggers

下面列出了一次软件包升级的顺序以及每个现有 Triggers 的详情:

all-%pretrans
…​
any-%triggerprein (%triggerprein from other packages set off by new install)
new-%triggerprein
new-%pre      for new version of package being installed
…​           (all new files are installed)
new-%post     for new version of package being installed

any-%triggerin (%triggerin from other packages set off by new install)
new-%triggerin
old-%triggerun
any-%triggerun (%triggerun from other packages set off by old uninstall)

old-%preun    for old version of package being removed
…​           (all old files are removed)
old-%postun   for old version of package being removed

old-%triggerpostun
any-%triggerpostun (%triggerpostun from other packages set off by old un
            install)
…​
all-%posttrans

以上项目位于 /usr/share/doc/rpm-4.*/triggers 文件中。