mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-28 13:48:49 +08:00
Adding Slackware platform information
This commit is contained in:
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…
x
Reference in New Issue
Block a user