1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-30 17:42:06 -04:00

system updater: make all distros use terminal

This commit is contained in:
bbedward
2026-04-29 14:40:16 -04:00
parent baaa30c94e
commit 1467f5dba9
15 changed files with 98 additions and 222 deletions

View File

@@ -6,6 +6,7 @@ import (
"encoding/json"
"fmt"
"os"
"os/exec"
"strings"
"time"
@@ -183,10 +184,20 @@ func runSystemUpdateApply() {
DryRun: sysUpdateDry,
}
onLine := func(line string) { fmt.Println(line) }
for _, b := range backends {
fmt.Printf("\n== %s ==\n", b.DisplayName())
if err := b.Upgrade(ctx, opts, onLine); err != nil {
cmd, err := b.UpgradeCommand(opts)
if err != nil {
log.Fatalf("%s: %v", b.ID(), err)
}
if cmd == "" {
continue
}
fmt.Printf("\n== %s ==\n$ %s\n\n", b.DisplayName(), cmd)
shell := exec.CommandContext(ctx, "sh", "-c", cmd)
shell.Stdin = os.Stdin
shell.Stdout = os.Stdout
shell.Stderr = os.Stderr
if err := shell.Run(); err != nil {
log.Fatalf("%s upgrade failed: %v", b.ID(), err)
}
}