Adding Slackware platform information

pull/558/head
Ozair Jr 7 years ago
parent d9d9688f3d
commit 0bab9611d2

@ -319,6 +319,12 @@ func PlatformInformationWithContext(ctx context.Context) (platform string, famil
if err == nil { if err == nil {
version = getRedhatishVersion(contents) 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")) { } else if common.PathExists(common.HostEtc("debian_version")) {
if lsb.ID == "Ubuntu" { if lsb.ID == "Ubuntu" {
platform = "ubuntu" platform = "ubuntu"
@ -441,6 +447,12 @@ func KernelVersionWithContext(ctx context.Context) (version string, err error) {
return version, nil 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 { func getRedhatishVersion(contents []string) string {
c := strings.ToLower(strings.Join(contents, "")) c := strings.ToLower(strings.Join(contents, ""))

Loading…
Cancel
Save