internal/router: supports UniFi UXG products

This commit is contained in:
Cuong Manh Le
2024-01-24 23:15:12 +07:00
committed by Cuong Manh Le
parent edca1f4f89
commit 99651f6e5b

View File

@@ -199,7 +199,7 @@ func distroName() string {
return merlin.Name
case haveFile("/etc/openwrt_version"):
return openwrt.Name
case haveDir("/data/unifi"):
case isUbios():
return ubios.Name
case bytes.HasPrefix(unameU(), []byte("synology")):
return synology.Name
@@ -234,3 +234,14 @@ func unameU() []byte {
out, _ := exec.Command("uname", "-u").Output()
return out
}
// isUbios reports whether the current machine is running on Ubios.
func isUbios() bool {
if haveDir("/data/unifi") {
return true
}
if err := exec.Command("ubnt-device-info", "firmware").Run(); err == nil {
return true
}
return false
}