control/controlclient: report Synology "distro" + its version to control

This commit is contained in:
Brad Fitzpatrick 2020-09-15 08:32:06 -07:00
parent 7e9d1f7808
commit 931bcd44cb
2 changed files with 12 additions and 2 deletions

View File

@ -84,7 +84,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
tailscale.com/util/lineread from tailscale.com/control/controlclient+
tailscale.com/util/pidowner from tailscale.com/ipn/ipnserver
tailscale.com/version from tailscale.com/control/controlclient+
tailscale.com/version/distro from tailscale.com/wgengine+
tailscale.com/version/distro from tailscale.com/control/controlclient+
tailscale.com/wgengine from tailscale.com/cmd/tailscaled+
tailscale.com/wgengine/filter from tailscale.com/control/controlclient+
tailscale.com/wgengine/magicsock from tailscale.com/cmd/tailscaled+

View File

@ -16,6 +16,7 @@
"go4.org/mem"
"tailscale.com/util/lineread"
"tailscale.com/version/distro"
)
func init() {
@ -23,8 +24,14 @@ func init() {
}
func osVersionLinux() string {
dist := distro.Get()
propFile := "/etc/os-release"
if dist == distro.Synology {
propFile = "/etc.defaults/VERSION"
}
m := map[string]string{}
lineread.File("/etc/os-release", func(line []byte) error {
lineread.File(propFile, func(line []byte) error {
eq := bytes.IndexByte(line, '=')
if eq == -1 {
return nil
@ -71,6 +78,9 @@ func osVersionLinux() string {
return fmt.Sprintf("%s%s", v, attr)
}
}
if dist == distro.Synology {
return fmt.Sprintf("Synology %s%s", m["productversion"], attr)
}
return fmt.Sprintf("Other%s", attr)
}