diff --git a/cmd/vinegar/vinegar.go b/cmd/vinegar/vinegar.go index 5790fa15..451893f1 100644 --- a/cmd/vinegar/vinegar.go +++ b/cmd/vinegar/vinegar.go @@ -47,13 +47,6 @@ func main() { editor.EditConfig(*configPath) case "uninstall": Uninstall() - case "reportinfo": - if report, err := util.GenerateInfo(*configPath); err != nil { - log.Fatal(err) // you have REALLY screwed up now - } - fmt.Println("Please share the information below.") - fmt.Printf("%+v\n", report) - } // These commands (except player & studio) don't require a configuration, // but they require a wineprefix, hence wineroot of configuration is required. case "player", "studio", "exec", "kill", "install-webview2", "winetricks": @@ -94,6 +87,15 @@ func main() { } case "kill": pfx.Kill() + + case "reportinfo": + if report, err := util.GenerateInfo(*configPath); err != nil { + log.Fatal(err) // you have REALLY screwed up now + } + fmt.Println("Please share the information below.") + fmt.Printf("%+v\n", report) + } + case "install-webview2": if err := InstallWebview2(&pfx); err != nil { log.Fatal(err) diff --git a/util/reportinfo.go b/util/reportinfo.go index 5e0177f4..27394ddd 100644 --- a/util/reportinfo.go +++ b/util/reportinfo.go @@ -15,10 +15,10 @@ import ( "github.com/vinegarhq/vinegar/internal/config" "os" "errors" + "regexp" ) type SysInfo struct { - CPUFlags string AVXAvailable bool Distro string //Done Kernel string // Done @@ -29,6 +29,16 @@ func GenerateInfo(currentConfigurationPath string) (SysInfo, error){ //TODO, returns struct Sysinfo. currentSystem := &SysInfo{} + // Check for AVX + if cpufile, err := os.ReadFile("/proc/cpuinfo"); err != nil { + return SysInfo{}, err + } else { + exp := regexp.MustCompile(`avx`) + matches := exp.FindStringSubmatch(string(cpufile)) + currentSystem.AVXAvailable = (len(matches) > 0) + } + + // Get Distro if distro, err := os.ReadFile("/etc/os-release"); err != nil { return SysInfo{}, err