Skip to content

Commit

Permalink
Merge pull request #558 from ozairjr/slackware-version
Browse files Browse the repository at this point in the history
Adding Slackware platform information
  • Loading branch information
shirou authored Jul 28, 2018
2 parents d9d9688 + 0bab961 commit c557538
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions host/host_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ func PlatformInformationWithContext(ctx context.Context) (platform string, famil
if err == nil {
version = getRedhatishVersion(contents)
}
} else if common.PathExists(common.HostEtc("slackware-version")) {
platform = "slackware"
contents, err := common.ReadLines(common.HostEtc("slackware-version"))
if err == nil {
version = getSlackwareVersion(contents)
}
} else if common.PathExists(common.HostEtc("debian_version")) {
if lsb.ID == "Ubuntu" {
platform = "ubuntu"
Expand Down Expand Up @@ -441,6 +447,12 @@ func KernelVersionWithContext(ctx context.Context) (version string, err error) {
return version, nil
}

func getSlackwareVersion(contents []string) string {
c := strings.ToLower(strings.Join(contents, ""))
c = strings.Replace(c, "slackware ", "", 1)
return c
}

func getRedhatishVersion(contents []string) string {
c := strings.ToLower(strings.Join(contents, ""))

Expand Down

0 comments on commit c557538

Please sign in to comment.