DNF4-POST-TRANSACTION-ACTIONS(8)

Heyyy bestie! πŸ’– You're reading the dnf4-post-transaction-actions(8) manual page, and it's literally about the DNF post transaction actions Plugin. By the end of this, you're gonna be defining actions like a total Unix main character. Let's go! ✨

🌸 NAME 🌸

dnf4-post-transaction-actions β€” DNF post transaction actions Plugin

πŸ’… DESCRIPTION πŸ’…

Okay so here's the tea: this plugin allows you to define actions that get executed upon completing an RPM transaction. No cap. Each action may define a (glob-like) filtering rule on the package NEVRA or package files, and it can also specify whether the package was installed or removed. Actions are defined in action files. Periodt. πŸ’…

πŸŽ€ CONFIGURATION πŸŽ€

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

  • enabled β€” Whether the plugin is enabled. Default value is True. Highkey useful!
  • actiondir β€” Path to the directory with action files. Action files must have the .action extension. Default value is "/etc/dnf/plugins/post-transaction-actions.d/". Iconic default, ngl.

πŸ¦‹ ACTION FILE FORMAT πŸ¦‹

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. It's giving format energy, bestie. πŸ¦‹

✨ package_filter ✨

A (glob-like) filtering rule applied on the package NEVRA (also in the shortened forms) or package files. This is how you pick which packages get the action, iykyk.

✨ transaction_state ✨

Filters packages according to their state in the transaction. Here's the breakdown:

  • 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

Each one's got its own vibe, fr fr.

✨ command ✨

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"

Okay so 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. Iconic efficiency! 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. (Yes, the original says trasaction_stateβ€”typo and all, we're keeping it! πŸ’€) However, the order of when a particular package_filter is invoked depends on the position of the corresponding package in the transaction. It's giving organized chaos and we love to see it. πŸ’–

An example action file: πŸ’«

# 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

Obsessed with this example, honestly. πŸŽ€

πŸ‘‘ AUTHOR πŸ‘‘

See AUTHORS in your Core DNF Plugins distribution. Go check it out bestie! πŸ‘‘

2014, Red Hat, Licensed under GPLv2+. Slay! πŸ’–


This page is from version 4.10.1, dated Mar 28, 2025. That's the dnf4-post-transaction-actions(8) manual page, bestie! Hope it slayed. πŸ’…βœ¨

πŸ“¦ where this page comes from