From 0bab9611d29eec0f25302137806c78f18ad53d70 Mon Sep 17 00:00:00 2001 From: Ozair Jr Date: Wed, 25 Jul 2018 10:17:08 -0300 Subject: [PATCH] Adding Slackware platform information --- host/host_linux.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/host/host_linux.go b/host/host_linux.go index 0e09f1585..7ca50897d 100644 --- a/host/host_linux.go +++ b/host/host_linux.go @@ -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" @@ -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, ""))