I would like to receive (email) notifications when new stable versions of certain packages are available for download and install on my Fedora installation from the official Fedora RPM repository. Specifically, I would like to know when I can install the updated software via DNF (dnf upgrade package-name). Note that I am not interested in notifications about upstream releases, I just want to know when the software in question has been packaged by Fedora and is available from the official repo.
My first instinct was to head to the Fedora Notifications service. However, I haven’t been able to find anything like that among the options it provides. The closest I’ve come is to configure the following rule:
Tracking Rule: Artifacts
Artifact names: rpms/package-name-here
Destination:
Optional Filters:
Applications: bodhi
Severities: info
However, this gives me notifications for every comment and action in the bodhi threads, which I certainly do not want. Furthermore, even if I were able to filter only the “has been pushed to stable” events from bodhi, it seems that relying on that event is not reliable for my use case either, since it does not actually mean that the updated package is yet installable via DNF (I’ve tried).
Bodhi push to stable is not the end. The repo still has to be composed (daily?), then your regional mirror(s) have to update (within hours?). In the worst case, you could wait >1 day after push to stable.
So, the only way to truly know if something is available via dnf is to use dnf on the same machine.
dnf check-update returns 100 when updates are available.
dnf -q --refresh check-update $package &>/dev/null;
if (( $? == 100 )); then
# email yourself
fi
Instead of constantly --refresh you may want to adjust your dnf-makecache.timer.
You could also use dnf-automatic and configure it to only notify you (dnf-automatic-notifyonly, no download, no install).
The issue could be that you get notified about any update, not just a specific package, but maybe there is a way to tweak dnf-automatic the way you want it.
As it turned out, DNF Automatic was exactly what I needed for my use case! I was able to configure it to only notify me about specific packages, and send me an email notification to my Gmail using the Himalaya email CLI. To help others who may have the same question, here are the steps I took and the configuration files I created.
Enabled the notification timer: systemctl enable --user --now dnf-automatic-notify.timer
Configuration files
~/.config/dnf-automatic/notify-via-email.conf
[commands]
# only notify, do not download or apply
download_updates = no
apply_updates = no
[emitters]
emit_via = command
[command]
# append the body to the template and send via Himalaya
command_format = "cat $XDG_DATA_HOME/himalaya/templates/dnf-automatic-notify.txt - | himalaya template send"
stdin_format = "{body}"
[base]
# This section overrides dnf.conf
# for some reason, `color="never"` does not work here, so instead
# we just override the color for this specific case to be normal
color_update_remote = "normal"
# only notify for these packages
# separate items with either a comma or a space
includepkgs = kernel*
[Unit]
Description=Timer for dnf-automatic-notify
# See comment in dnf-makecache.service
ConditionPathExists=!/run/ostree-booted
[Timer]
# Every day at 12:00
OnCalendar=*-*-* 12:00
Persistent=true
[Install]
WantedBy=timers.target
If you want to use Himalaya for sending emails, refer to their documentation to configure it for your needs.
Important notes
The includepkgs option of DNF
If you run dnf-automatic directly (not via a service) and DNF fails to resolve a candidate for the listed package or there are conflicts with it, DNF Automatic will fail silently*, and your configured command won’t be run. This can happen if you have included packages that depend on other packages. For example, if you only include firefox , DNF will likely fail unless you also include firefox-langpacks. Alternatively, you can use a wildcard: firefox*.
* This is true even if you use debugmode=10!
DNF Automatic will be be obsoleted in Fedora 39
If you’re configuring DNF Automatic for Fedora 38, be aware that your setup may not be very long-lived. DNF Automatic is scheduled to be obsoleted in Fedora 39, and will be replaced by a new tool. Anyone using DNF Automatic will likely need to change their setup to use the new tool.