forked from TrueCloudLab/rclone
version: fix reported os/kernel version for windows
This commit is contained in:
parent
52fbb10b47
commit
bdfe213c47
1 changed files with 3 additions and 9 deletions
|
@ -1,7 +1,6 @@
|
||||||
package buildinfo
|
package buildinfo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
@ -32,10 +31,10 @@ func GetOSVersion() (osVersion, osKernel string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simplify kernel output: `RELEASE.BUILD Build BUILD` -> `RELEASE.BUILD`
|
// Simplify kernel output: `MAJOR.MINOR.BUILD.REVISION Build BUILD.REVISION` -> `MAJOR.MINOR.BUILD.REVISION`
|
||||||
match := regexp.MustCompile(`^([\d\.]+?\.)(\d+) Build (\d+)$`).FindStringSubmatch(osKernel)
|
match := regexp.MustCompile(`^(\d+\.\d+\.(\d+\.\d+)) Build (\d+\.\d+)$`).FindStringSubmatch(osKernel)
|
||||||
if len(match) == 4 && match[2] == match[3] {
|
if len(match) == 4 && match[2] == match[3] {
|
||||||
osKernel = match[1] + match[2]
|
osKernel = match[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +52,6 @@ func GetOSVersion() (osVersion, osKernel string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRevision := getRegistryVersionInt("UBR")
|
|
||||||
if osKernel != "" && updateRevision != 0 {
|
|
||||||
osKernel += fmt.Sprintf(".%d", updateRevision)
|
|
||||||
}
|
|
||||||
|
|
||||||
if arch, err := host.KernelArch(); err == nil && arch != "" {
|
if arch, err := host.KernelArch(); err == nil && arch != "" {
|
||||||
if strings.HasSuffix(arch, "64") && osVersion != "" {
|
if strings.HasSuffix(arch, "64") && osVersion != "" {
|
||||||
osVersion += " (64 bit)"
|
osVersion += " (64 bit)"
|
||||||
|
|
Loading…
Reference in a new issue