internal/router: supports UniFi UXG products

This commit is contained in:
Cuong Manh Le
2024-02-07 14:38:50 +07:00
committed by Cuong Manh Le
parent edca1f4f89
commit 99651f6e5b
+12 -1
View File
@@ -199,7 +199,7 @@ func distroName() string {
return merlin.Name return merlin.Name
case haveFile("/etc/openwrt_version"): case haveFile("/etc/openwrt_version"):
return openwrt.Name return openwrt.Name
case haveDir("/data/unifi"): case isUbios():
return ubios.Name return ubios.Name
case bytes.HasPrefix(unameU(), []byte("synology")): case bytes.HasPrefix(unameU(), []byte("synology")):
return synology.Name return synology.Name
@@ -234,3 +234,14 @@ func unameU() []byte {
out, _ := exec.Command("uname", "-u").Output() out, _ := exec.Command("uname", "-u").Output()
return out 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
}