Is there a DNF equivalent of APT::Update::Post-Invoke?

Hi,

I’d like to invoke a command after an update (DNF, Gnome Software, Automatic Update) is completed but I haven’t found a way to do so. Does anyone know if DNF has a function for that?

Thanks,

Should be able to just do:
sudo dnf upgrade && <command>

Should run the next command as long as the first succeeded.

1 Like

Sorry I should have been more precise. I’d like a solution that works in every situation (Gnome Software, DNF, automatic updates) and something similar to a post invoke function would be better for my use case.

Many packages have scripts included that do pre & post actions. If you run dnf update|upgrade you can watch them function during the updates. Since many rpms have the post install/upgrade scripts included it seems to me that your quest is already answered by the way packages are created and installed. With the scripts within the package it works regardless of what front end is used to control the install.

Here is an example from my dnf update done just today

  Upgrading        : pipewire-libs-0.3.33-3.fc34.x86_64                    2/81 
  Running scriptlet: pipewire-0.3.33-3.fc34.x86_64                         3/81 
  Upgrading        : pipewire-0.3.33-3.fc34.x86_64                         3/81 
  Running scriptlet: pipewire-0.3.33-3.fc34.x86_64                         3/81 

Sorry for misunderstanding.

https://dnf-plugins-core.readthedocs.io/en/latest/post-transaction-actions.html

It will need to be installed, but should work for dnf.

I haven’t been able to find any references on doing that with gnome-software/packagekit.

Thanks

1 Like

For my use case, I need the hook to be triggered at the end of the whole update process. Sadly, post-transaction-actions is triggered after each package update.

But thanks for the suggestion. Maybe I could explore the idea of making my own dnf plugin if it isn’t to hard. I have some programming experiences. I’d just need to find some free time :).

1 Like