mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-20 09:57:31 +00:00
hostinfo: determine QNAP QTS version
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
This commit is contained in:

committed by
Denton Gentry

parent
d17849461c
commit
4dd799ec43
@@ -48,7 +48,17 @@ func linuxDeviceModel() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func getQnapQtsVersion(versionInfo string) string {
|
||||
for _, field := range strings.Fields(versionInfo) {
|
||||
if suffix := strings.TrimPrefix(field, "QTSFW_"); suffix != field {
|
||||
return "QTS " + suffix
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func osVersionLinux() string {
|
||||
// TODO(bradfitz,dgentry): cache this, or make caller(s) cache it.
|
||||
dist := distro.Get()
|
||||
propFile := "/etc/os-release"
|
||||
switch dist {
|
||||
@@ -59,6 +69,9 @@ func osVersionLinux() string {
|
||||
case distro.WDMyCloud:
|
||||
slurp, _ := ioutil.ReadFile("/etc/version")
|
||||
return fmt.Sprintf("%s", string(bytes.TrimSpace(slurp)))
|
||||
case distro.QNAP:
|
||||
slurp, _ := ioutil.ReadFile("/etc/version_info")
|
||||
return getQnapQtsVersion(string(slurp))
|
||||
}
|
||||
|
||||
m := map[string]string{}
|
||||
|
Reference in New Issue
Block a user