Skip to content

Commit

Permalink
Add linuxmint to the debian OS family (#117)
Browse files Browse the repository at this point in the history
Add test data from Linux Mint 20 and categorize the OS as part of the debian family.
Linux Mint derives from Ubuntu which derives from Debian.

Fixes #52
  • Loading branch information
andrewkroh authored Jun 4, 2022
1 parent 88df338 commit 69da652
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion providers/linux/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}

Expand Down
16 changes: 16 additions & 0 deletions providers/linux/os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions providers/linux/testdata/linuxmint20/etc/lsb-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=20
DISTRIB_CODENAME=ulyana
DISTRIB_DESCRIPTION="Linux Mint 20 Ulyana"
1 change: 1 addition & 0 deletions providers/linux/testdata/linuxmint20/etc/os-release
12 changes: 12 additions & 0 deletions providers/linux/testdata/linuxmint20/usr/lib/os-release
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 69da652

Please sign in to comment.