1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-11 23:09:42 -04:00

refactor(sysupdate): improve cmd handling, formatted colors & progress indication

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
purian23
2026-05-04 13:13:44 -04:00
parent cfe6e6867e
commit 408beb202c
9 changed files with 113 additions and 23 deletions

View File

@@ -9,6 +9,8 @@ import (
"os/exec"
"sync"
"syscall"
"github.com/AvengeMedia/DankMaterialShell/core/internal/privesc"
)
type RunOptions struct {
@@ -77,6 +79,18 @@ func Capture(ctx context.Context, argv []string) (string, error) {
return string(out), err
}
// privescBin returns the binary to use for privilege escalation.
// When useSudo is true it auto-detects the best available tool (sudo/doas/run0).
// When false it falls back to pkexec for GUI callers.
func privescBin(useSudo bool) string {
if useSudo {
if t, err := privesc.Detect(); err == nil {
return t.Name()
}
}
return "pkexec"
}
func findTerminal(override string) string {
if override != "" && commandExists(override) {
return override