From d753f78612a0af2d3359375e71f70f337023471a Mon Sep 17 00:00:00 2001 From: Bryce Kahle Date: Thu, 18 Jan 2024 10:34:34 -0800 Subject: [PATCH] use VERSION_ID from os-release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `VERSION_ID` is more appropriate for scripts and other usages, since `VERSION` can contain spaces and codenames from `os-release` manpage: ``` VERSION= A string identifying the operating system version, excluding any OS name information, possibly including a release code name, and suitable for presentation to the user. This field is optional. Examples: "VERSION=17", "VERSION="17 (Beefy Miracle)"". VERSION_ID= A lower-case string (mostly numeric, no spaces or other characters outside of 0–9, a–z, ".", "_" and "-") identifying the operating system version, excluding any OS name information or release code name, and suitable for processing by scripts or usage in generated filenames. This field is optional. Examples: "VERSION_ID=17", "VERSION_ID=11.04". ``` --- internal/common/common_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/common/common_linux.go b/internal/common/common_linux.go index b08cf33ae..a429e16a2 100644 --- a/internal/common/common_linux.go +++ b/internal/common/common_linux.go @@ -329,7 +329,7 @@ func GetOSReleaseWithContext(ctx context.Context) (platform string, version stri switch field[0] { case "ID": // use ID for lowercase platform = trimQuotes(field[1]) - case "VERSION": + case "VERSION_ID": version = trimQuotes(field[1]) } }