v0.0.4 - 更新适配MAC系统和类BSD系统

This commit is contained in:
spiritlhl
2024-07-01 15:58:47 +00:00
parent ee06b25ec7
commit d2e8e4c1fa
8 changed files with 101 additions and 24 deletions

24
system/macos.go Normal file
View File

@@ -0,0 +1,24 @@
package system
import (
"os/exec"
"strings"
"github.com/oneclickvirt/basics/model"
)
func isMacOS() bool {
out, err := exec.Command("uname", "-a").Output()
if err != nil {
return false
}
systemName := strings.ToLower(string(out))
return strings.Contains(systemName, "darwin")
}
func getMacOSInfo() {
out, err := exec.Command("system_profiler", "SPHardwareDataType").Output()
if err == nil && !strings.Contains(string(out), "error") {
model.MacOSInfo = strings.Split(string(out), "\n")
}
}