Dnf5 snapper.actions gives no description of the package installed

I have created the snapper.actions files with the template provided in the documentation:

# 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\ -p)"

# 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}"\ ;\ echo\ tmp.snapper_pre_number

It works correctly except that it does not describe which package is updated and that sort of makes it useless.

Does anybody know how to get the description ?

Added cinnamon, dnf5, f40

I would try adding -d ${pkg.nevra} and see if that does what you want.

As a side note, you should also set the cleanup algorithm to number or those snapshots will never get cleaned up unless you delete them manually.

Out of curiosity, does that run for every package? Will it take multiple snapshots if you install more than one package?

1 Like

Thank you for answering. Adding pkg.nevra did not solve it. Regarding your questions, it only creates one pre and post regardless of the number of packages installed at a time.

Yeah, the problem is on the action syntax itself:

Each non-comment line defines an action and consists of five items separated by colons: callback_name:package_filter:direction:options:command .

If package_filter from that has nothing, you get you value for ${pkg.*} which makes it pretty useless really. It’d be nice to be able to get the dnf command called itself or something in this, because if you set package_filter to * it runs it MULTIPLE times, once per package, and we certainly don’t want multiple snapshots here.

dalto was right though, -d\ '${pkg.nevra}' or even just pkg.name would get you enough to at least provide something, but this actions seems extremely more limited than the python alternative that dnf has already had…

Yep, i gave up and went back to dnf4. That extra speed offered by dnf5 isn’t really that important to me since i only update my system once or twice per month.