diff --git a/CHANGELOG.md b/CHANGELOG.md index 902c4efb..e7c7bb1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added the Oracle Linux ("ol") platform to the "redhat" OS family. [#54](https://github.com/elastic/go-sysinfo/issues/54) [#115](https://github.com/elastic/go-sysinfo/pull/115) +- Added the Linux Mint ("linuxmint") platform to the "debian" OS family. [#52](https://github.com/elastic/go-sysinfo/issues/52) + ### Changed -- Added the Oracle Linux ("ol") platform to "redhat" OS family. [#54](https://github.com/elastic/go-sysinfo/issues/54) [#115](https://github.com/elastic/go-sysinfo/pull/115) - Updated module to require Go 1.17. [#111](https://github.com/elastic/go-sysinfo/pull/111) - The boot time value for Windows is now rounded to the nearest second to provide a more stable value. [#53](https://github.com/elastic/go-sysinfo/issues/53) [#114](https://github.com/elastic/go-sysinfo/pull/114) diff --git a/providers/linux/os.go b/providers/linux/os.go index 19ff00c0..b0402009 100644 --- a/providers/linux/os.go +++ b/providers/linux/os.go @@ -51,7 +51,7 @@ var ( // familyMap contains a mapping of family -> []platforms. var familyMap = map[string][]string{ "redhat": {"redhat", "fedora", "centos", "scientific", "oraclelinux", "ol", "amzn", "rhel"}, - "debian": {"debian", "ubuntu", "raspbian"}, + "debian": {"debian", "ubuntu", "raspbian", "linuxmint"}, "suse": {"suse", "sles", "opensuse"}, } diff --git a/providers/linux/os_test.go b/providers/linux/os_test.go index 422ab02e..9d7a3420 100644 --- a/providers/linux/os_test.go +++ b/providers/linux/os_test.go @@ -131,6 +131,22 @@ func TestOperatingSystem(t *testing.T) { }, *os) t.Logf("%#v", os) }) + t.Run("linuxmint20", func(t *testing.T) { + os, err := getOSInfo("testdata/linuxmint20") + if err != nil { + t.Fatal(err) + } + assert.Equal(t, types.OSInfo{ + Type: "linux", + Family: "debian", + Platform: "linuxmint", + Name: "Linux Mint", + Version: "20 (Ulyana)", + Major: 20, + Codename: "ulyana", + }, *os) + t.Logf("%#v", os) + }) t.Run("redhat7", func(t *testing.T) { os, err := getOSInfo("testdata/redhat7") if err != nil { diff --git a/providers/linux/testdata/linuxmint20/etc/lsb-release b/providers/linux/testdata/linuxmint20/etc/lsb-release new file mode 100644 index 00000000..c27d35fe --- /dev/null +++ b/providers/linux/testdata/linuxmint20/etc/lsb-release @@ -0,0 +1,4 @@ +DISTRIB_ID=LinuxMint +DISTRIB_RELEASE=20 +DISTRIB_CODENAME=ulyana +DISTRIB_DESCRIPTION="Linux Mint 20 Ulyana" diff --git a/providers/linux/testdata/linuxmint20/etc/os-release b/providers/linux/testdata/linuxmint20/etc/os-release new file mode 120000 index 00000000..c4c75b41 --- /dev/null +++ b/providers/linux/testdata/linuxmint20/etc/os-release @@ -0,0 +1 @@ +../usr/lib/os-release \ No newline at end of file diff --git a/providers/linux/testdata/linuxmint20/usr/lib/os-release b/providers/linux/testdata/linuxmint20/usr/lib/os-release new file mode 100644 index 00000000..825d9287 --- /dev/null +++ b/providers/linux/testdata/linuxmint20/usr/lib/os-release @@ -0,0 +1,12 @@ +NAME="Linux Mint" +VERSION="20 (Ulyana)" +ID=linuxmint +ID_LIKE=ubuntu +PRETTY_NAME="Linux Mint 20" +VERSION_ID="20" +HOME_URL="https://www.linuxmint.com/" +SUPPORT_URL="https://forums.linuxmint.com/" +BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/" +PRIVACY_POLICY_URL="https://www.linuxmint.com/" +VERSION_CODENAME=ulyana +UBUNTU_CODENAME=focal