DNF-POST-TRANSACTION-ACTIONS(8)
π DNF-POST-TRANSACTION-ACTIONS(8) π
okay bestie, pull up a chair, we're talking about dnf-post-transaction-actions β a little plugin from the dnf-plugins-core crew that lets you make stuff happen after an RPM transaction finishes. literally the "and then what" of package management. π
β¨ NAME β¨
dnf-post-transaction-actions β the DNF post transaction actions Plugin. that's it, that's the name, and honestly? iconic. π
πΈ DESCRIPTION πΈ
so here's the vibe: this plugin lets you define actions that get executed once an RPM transaction is done. and each action can define a (glob-like) filtering rule, either on the package NEVRA or on package files, plus whether the package was installed or removed. all of that lives in something called action files. π¦
π CONFIGURATION π
the plugin's config lives right here:
/etc/dnf/plugins/post-transaction-actions.conf
and every single config option chills in the [main] section. no cap.
enabledβ whether the plugin is enabled. default value isTrue. (yes bestie, it's on by default, she's eager like that π)actiondirβ the path to the directory holding your action files. heads up: action files must have the.actionextension or they simply do not count. default value is/etc/dnf/plugins/post-transaction-actions.d/.
π«Ά ACTION FILE FORMAT π«Ά
empty lines? ignored. lines starting with a # character? also ignored. we love a comment that minds its own business. π
each non-comment line defines an action, and it's made of three items separated by colons:
package_filter:transaction_state:command
let's break it down, one by one, no skipping. β
package_filter
a (glob-like) filtering rule applied on the package NEVRA β and yes, also in the shortened forms β or on package files.
transaction_state
this one filters packages according to their state in the transaction. three options, take your pick:
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. every single one. the whole friend group. π
command
any shell command, bestie. ANY. and the following variables inside the command get 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 gets evaluated for every package that matched the package_filter and the transaction_state. but here's the plot twist: after variable substitution, any duplicate commands get removed, and each command is only executed once per transaction. one and done, we don't do encores. π
as for order? the order of execution of the commands follows the order in the action files, but it may differ from the order of packages in the transaction. so β when you define several action lines for the same package_filter, those lines will be executed in the order they were defined in the action file, when the package_filter matches a package during the transaction_state state. HOWEVER, the order of when a particular package_filter gets invoked depends on the position of the corresponding package in the transaction. yes it's a little unhinged. yes it's fine. π
π 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
look at her go. π₯Ή
π AUTHOR π
See AUTHORS in your Core DNF Plugins distribution.
π COPYRIGHT π
2023, Red Hat, Licensed under GPLv2+
bestie this is version 4.3.1, dated Jan 22, 2023, and it's part of the dnf-plugins-core distribution. go forth and post-transaction-action responsibly. slay, periodt. πβ¨ππ¦πΈπ«Ά
π¦ where this page comes from
- debian bookworm: dnf-plugins-core 4.3.1-3 Β· GPL-2.0-or-later
- ubuntu noble: dnf-plugins-core 4.3.1-3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms