summaryrefslogtreecommitdiff
path: root/apt.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-03 08:40:15 -0500
committerJeff Carr <[email protected]>2025-10-03 08:40:15 -0500
commit137fbac44c6bdfd746bd561377b3a28988f15172 (patch)
tree7b224df39bb82ab3b338151f725b40326b393463 /apt.go
parent8514f8fb6b6b74323186bd738e8d592332df3042 (diff)
smarter apt force install
Diffstat (limited to 'apt.go')
-rw-r--r--apt.go28
1 files changed, 22 insertions, 6 deletions
diff --git a/apt.go b/apt.go
index d2524b5..04639cb 100644
--- a/apt.go
+++ b/apt.go
@@ -4,27 +4,43 @@
package main
import (
+ "github.com/go-cmd/cmd"
+ "go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
-func aptInstall(pkgname string) {
+func aptInstall(pkgname string) (*cmd.Status, error) {
cmd := []string{"apt-get", "install", "-y", pkgname}
log.Info("Running:", cmd)
- exitOnError(cmd)
+ return shell.RunRealtimeError(cmd)
}
-func aptRemove(pkgname string) {
+func aptInstallOrExit(pkgname string) {
+ if _, err := aptInstall(pkgname); err != nil {
+ badExit(err)
+ }
+}
+
+func aptRemove(pkgname string) (*cmd.Status, error) {
if pkgname == "mirrors.wit.com" {
- return
+ return nil, nil
}
cmd := []string{"apt-get", "remove", "-y", pkgname}
log.Info("Running:", cmd)
- exitOnError(cmd)
+ return shell.RunRealtimeError(cmd)
+}
+
+func aptRemoveOrExit(pkgname string) {
+ if _, err := aptRemove(pkgname); err != nil {
+ badExit(err)
+ }
}
func aptUpdate() {
cmd := []string{"apt", "update"}
- exitOnError(cmd)
+ if _, err := shell.RunRealtimeError(cmd); err != nil {
+ badExit(err)
+ }
aptInstall("wit-tools")
}