This commit is contained in:
2025-04-14 23:35:10 +03:00
parent e3aaa88822
commit 6d5016270f
21 changed files with 449 additions and 349 deletions

View File

@ -20,6 +20,7 @@ import (
"fmt"
"os/exec"
"strings"
"syscall"
)
// APTRpm represents the APT-RPM package manager
@ -110,7 +111,11 @@ func (a *APTRpm) UpgradeAll(opts *Opts) error {
func (a *APTRpm) getCmd(opts *Opts, mgrCmd string, args ...string) *exec.Cmd {
var cmd *exec.Cmd
if opts.AsRoot {
cmd = exec.Command(getRootCmd(a.rootCmd), mgrCmd)
if syscall.Geteuid() != 0 {
cmd = exec.Command(getRootCmd(a.rootCmd), mgrCmd)
} else {
cmd = exec.Command(mgrCmd)
}
cmd.Args = append(cmd.Args, opts.Args...)
cmd.Args = append(cmd.Args, args...)
} else {