mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-29 04:22:24 +00:00
hostinfo: set DeviceModel from Linux devicetree model
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
3ac731dda1
commit
6990a314f5
@ -11,6 +11,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
@ -20,6 +21,12 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
osVersion = osVersionLinux
|
osVersion = osVersionLinux
|
||||||
|
|
||||||
|
if v, _ := os.ReadFile("/sys/firmware/devicetree/base/model"); len(v) > 0 {
|
||||||
|
// Look up "Raspberry Pi 4 Model B Rev 1.2",
|
||||||
|
// etc. Usually set on ARM SBCs.
|
||||||
|
SetDeviceModel(strings.Trim(string(v), "\x00\r\n\t "))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func osVersionLinux() string {
|
func osVersionLinux() string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user