Getting the latest version of OpenWRT in a script

Is there a way to get the current version of OpenWRT from a script? I am looking for a way to get the latest version number with curl. I want to setup automated reminders to update but I need to be able to fetch the current version.

When you say current version, do you mean the currently installed version (on a given device), or the latest version available (from the OpenWrt servers)?

If the latter, one method would be to follow the link under "Stable release" and then parse the value after "current stable release"
https://openwrt.org/releases/start

There is a release tags RSS feed to which you can simply subscribe:
https://github.com/openwrt/openwrt/tags.atom
and an HTML page you could scrape for release tags:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=tags
With the caveat that, while fairly reliable, tags are tags and not an indicator of an actual release, and releases are tagged quite some time before they are compiled and actually ready for download.

1 Like

And there's also the sysupgrade revision API, documented at https://sysupgrade.openwrt.org/ui/#/default/asu.api.api_v1_revision

$ curl  https://sysupgrade.openwrt.org/api/v1/revision/23.05.3/mediatek/mt7622
{"revision":"r23809-234f1a2efa"}

$ curl  https://sysupgrade.openwrt.org/api/v1/revision/SNAPSHOT/mediatek/mt7622
{"revision":"r26843-4cc69a6542"}

If you are looking for releases, look in the (undocumented) https://downloads.openwrt.org/.versions.json

$ curl https://downloads.openwrt.org/.versions.json
{
"stable_version": "23.05.3",
"oldstable_version": "22.03.6",
"upcoming_version": "",
"versions_list": ["23.05.3","23.05.2","23.05.1","23.05.0","22.03.6","22.03.5","22.03.4","22.03.3","22.03.2","22.03.1","22.03.0","21.02.7","21.02.6","21.02.5","21.02.4","21.02.3","21.02.2","21.02.1","21.02.0","19.07.10","19.07.9","19.07.8","19.07.7","19.07.6","19.07.5","19.07.4","19.07.3","19.07.2","19.07.1","19.07.0","18.06.9","18.06.8","18.06.7","18.06.6","18.06.5","18.06.4","18.06.3","18.06.2","18.06.1","18.06.0","17.01.7","17.01.6","17.01.5","17.01.4","17.01.3","17.01.2","17.01.1"]
}
1 Like