Dnf5 transaction actions don't work with gnome-software and discover

hey guys, does someone have a solution for this? I installed fedora 41 with snapper and, as the python3-dnf-plugin-snapper doesn’t work anymore with dnf5, I created some actions file so the snapshots are created when I install software or update the system. This works fine when I do it through the terminal, but if I install software or update the system with gnome-software (which does an offline upgrade btw), the transaction actions for snapper don’t work anymore.

Here’s the actions:

/etc/dnf/libdnf5-plugins/actions.d/snapper.actions

# Get snapshot description
pre_transaction::::/usr/bin/sh -c echo\ "tmp.cmd=$(ps\ -o\ command\ --no-headers\ -p\ '${pid}')"

# Creates pre snapshot before the transaction and stores the snapshot number in the "tmp.snapper_pre_number"  variable.
pre_transaction::::/usr/bin/sh -c echo\ "tmp.snapper_pre_number=$(snapper\ create\ -t\ pre\ -c\ number\ -p\ -d\ '${tmp.cmd}')"

# If the variable "tmp.snapper_pre_number" exists, it creates post snapshot after the transaction and removes the variable "tmp.snapper_pre_number".
post_transaction::::/usr/bin/sh -c [\ -n\ "${tmp.snapper_pre_number}"\ ]\ &&\ snapper\ create\ -t\ post\ --pre-number\ "${tmp.snapper_pre_number}"\ -c\ number\ -d\ "${tmp.cmd}"\ ;\ echo\ tmp.snapper_pre_number\ ;\ echo\ tmp.cmd\ ;\ sudo\ grub2-mkconfig\ -o\ /boot/grub2/grub.cfg
1 Like