summaryrefslogtreecommitdiff
path: root/linux.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-12 15:10:50 -0600
committerJeff Carr <[email protected]>2025-02-12 15:10:50 -0600
commit06564368bc07e90e721c26cb074d45e3a8ab3d6b (patch)
treed2a3a7699d3bd3915a3f43ceb8af2d95ac56eddf /linux.go
parent815d061d5dab25614afa9ebe319456e3d4c1d16b (diff)
first attempt to install protoc on linuxv0.0.8v0.0.7v0.0.6
Diffstat (limited to 'linux.go')
-rw-r--r--linux.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/linux.go b/linux.go
new file mode 100644
index 0000000..efdb6e8
--- /dev/null
+++ b/linux.go
@@ -0,0 +1,34 @@
+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 linuxInstall(pkg string) {
+ 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)
+ default:
+ }
+ }
+}