1

I want to get the latest LTS version's code-name for my Docker build CI programmatically through cURL. Is there any API-friendly way to query this or do I need to handle the scraping stuff and math logic from https://cdimage.ubuntu.com/releases/ index (not necessarily Ubuntu-dependent but can be used on any distro)?

  • 1
    Since you mentioned other distros, for Debian you can curl its repo like so curl https://deb.debian.org/debian/dists/stable/Release | grep ^Codename: – Arctic Kona Nov 04 '21 at 09:19

1 Answers1

3

You can do what do-release-upgrade does and use https://changelogs.ubuntu.com/meta-release-lts to get the list of LTS releases and parse that:

% curl -s https://changelogs.ubuntu.com/meta-release-lts | grep Name: | tail -n1
Name: Focal Fossa

The format of https://changelogs.ubuntu.com/meta-release-lts is fairly simple and shouldn't be difficult to parse. There's also https://changelogs.ubuntu.com/meta-release for all releases.

muru
  • 197,895
  • 55
  • 485
  • 740