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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user