Is it possible to verify that a major release is already released?

I wrote a script wrapper for system-upgrade, which will update the system, then proceeds to download the new major release and finally reboots to install it.

This script works perfectly fine for everything included. There is only one thing I would like to add and that is to check if the next release is actually released or still in beta. The script shall only download and install a finished release (to make sure that one does not end up with an unstable system).

Example:
As of this writing, Fedora 35 is the latest release. However, if I run the script, it would still upgrade to Fedora 36 as all packages and links are already available.

Is there a way to check from the command-line if the next major release is already out?

2 Likes

There’s probably a simpler way to do this, I’m just overthinking it…
edit see @vgaetera post below …

curl "https://dl.fedoraproject.org/pub/fedora/imagelist-fedora" | grep '/releases\/35/'

You could pull the version from /etc/os-release and just add one to check the next version up.

1 Like
sudo dnf install curl jq
. /etc/os-release
VERSION_GET="$(curl -s "https://getfedora.org/releases.json" \
| jq -r '[.[].version | select(test("^\\d*$"))] | max')"
if [ "${VERSION_ID}" -eq "${VERSION_GET}" ]; then exit 0; fi

Fedora Mirror isssue - #2 by vgaetera

6 Likes

Yeah, this is the best way programmatically right now.

However, note that this file is currently updated by hand. That means it isn’t instant, and also, is prone to mistakes or format changes. Adam Williamson has some work in progress to fix that, but it’s hard to get it to the top of the priority list.

Note @vgaetera I checked the source repo changelog and when F35 was in beta, it was listed as "version": "35 Beta". As written, your jq ignores that — which is correct for the question asked, but might also be useful to take into account.

Finally came around testing it. Works like a charm. I added a test using which curl jq beforehand, so I do not need to run dnf for this unless it is missing.

Thanks a lot!

1 Like