From cc5db9ba7ea3d4b636ea2870fe0a3f3decaa9177 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 31 Aug 2025 17:19:53 -0500 Subject: attempt to fix macos build --- install_linux.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 install_linux.go (limited to 'install_linux.go') diff --git a/install_linux.go b/install_linux.go new file mode 100644 index 0000000..0ed600b --- /dev/null +++ b/install_linux.go @@ -0,0 +1,36 @@ +package fhelp + +// auto run protoc with the correct args + +import ( + "bufio" + "fmt" + "os" + "strings" + + "go.wit.com/lib/gui/shell" + "go.wit.com/log" +) + +func osInstall(pkg string) error { + cmd := []string{"apt", "install", "-y", pkg} + if pkg == "protoc" { + cmd = []string{"apt", "install", "-y", "protobuf-compiler"} + } + log.Info("Would you like to run", "sudo", cmd, "now?") + fmt.Fprintf(os.Stdout, "(y)es or (n)o ? ") + + scanner := bufio.NewScanner(os.Stdin) + for scanner.Scan() { + line := scanner.Text() + line = strings.TrimSpace(line) + line = strings.ToLower(line) + switch line { + case "y": + shell.Sudo(cmd) + return nil + default: + } + } + return log.Errorf("user didn't install package %s", pkg) +} -- cgit v1.2.3