Ophestra Umiker
084cd84f36
This commit does away with almost all baggage left over from the Ego port. Error wrapping also got simplified. All API changes happens to be internal which means no changes to main except renaming of the BaseError type. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
33 lines
565 B
Go
33 lines
565 B
Go
package app
|
|
|
|
import (
|
|
"os"
|
|
|
|
"git.ophivana.moe/cat/fortify/internal/verbose"
|
|
)
|
|
|
|
const (
|
|
sudoAskPass = "SUDO_ASKPASS"
|
|
)
|
|
|
|
func (a *app) commandBuilderSudo(shimEnv string) (args []string) {
|
|
args = make([]string, 0, 8)
|
|
|
|
// -Hiu $USER
|
|
args = append(args, "-Hiu", a.seal.sys.user.Username)
|
|
|
|
// -A?
|
|
if _, ok := os.LookupEnv(sudoAskPass); ok {
|
|
verbose.Printf("%s set, adding askpass flag\n", sudoAskPass)
|
|
args = append(args, "-A")
|
|
}
|
|
|
|
// shim payload
|
|
args = append(args, shimEnv)
|
|
|
|
// -- $@
|
|
args = append(args, "--", a.seal.sys.executable, "shim")
|
|
|
|
return
|
|
}
|