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