DOKK / manpages / debian 12 / dnf-plugins-core / dnf-post-transaction-actions.8.en
DNF-POST-TRANSACTION-ACTIONS(8) dnf-plugins-core DNF-POST-TRANSACTION-ACTIONS(8)

dnf-post-transaction-actions - DNF post transaction actions Plugin

The plugin allows to define actions to be executed upon completing an RPM transaction. Each action may define a (glob-like) filtering rule on the package NEVRA or package files, as well as whether the package was installed or removed. Actions are defined in action files.

The plugin configuration is in /etc/dnf/plugins/post-transaction-actions.conf. All configuration options are in the [main] section.

Whether the plugin is enabled. Default value is True.
Path to the directory with action files. Action files must have the “.action” extension. Default value is “/etc/dnf/plugins/post-transaction-actions.d/”.

Empty lines and lines that start with a ‘#’ character are ignored. Each non-comment line defines an action and consists of three items separated by colons: package_filter:transaction_state:command.

A (glob-like) filtering rule aplied on the package NEVRA (also in the shortened forms) or package files.
Filters packages according to their state in the transaction.
  • in - packages that appeared on the system (downgrade, install, obsolete, reinstall, upgrade)
  • out - packages that disappeared from the system (downgraded, obsoleted, remove, upgraded)
  • any - all packages

Any shell command. The following variables in the command will be substituted:
  • ${name}, $name - package name
  • ${arch}, $arch - package arch
  • ${ver}, $ver - package version
  • ${rel}, $rel - package release
  • ${epoch}, $epoch - package epoch
  • ${repoid}, $repoid - package repository id
${state}, $state - the change of package state in the transaction:
“downgrade”, “downgraded”, “install”, “obsolete”, “obsoleted”, “reinstall”, “reinstalled”, “remove”, “upgrade”, “upgraded”




The shell command will be evaluated for each package that matched the package_filter and the transaction_state. However, after variable substitution, any duplicate commands will be removed and each command will only be executed once per transaction. The order of execution of the commands follows the order in the action files, but may differ from the order of packages in the transaction. In other words, when you define several action lines for the same package_filter these lines will be executed in the order they were defined in the action file when the package_filter matches a package during the trasaction_state state. However, the order of when a particular package_filter is invoked depends on the position of the corresponding package in the transaction.


# log all packages (state, nevra, repo) in transaction into a file.
*:any:echo '${state} ${name}-${epoch}:${ver}-${rel}.${arch} repo ${repoid}' >>/tmp/post-trans-actions-trans.log
# The same shell command (after variables substitution) is executed only once per transaction.
*:any:echo '${repoid}' >>/tmp/post-trans-actions-repos
# will write each repo only once to /tmp/post-trans-actions-repos, even if multiple packages from
# the same repo were matched


See AUTHORS in your Core DNF Plugins distribution

2023, Red Hat, Licensed under GPLv2+

January 22, 2023 4.3.1