Use doas instead of sudo if installed (MR 2091)

Prefer using doas over sudo if both are installed. Let the user override
the sudo tool with PMB_SUDO.
This commit is contained in:
Anjandev Momi 2021-08-08 23:14:39 -04:00 committed by Oliver Smith
parent 2801b5d687
commit c1407f921b
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
8 changed files with 60 additions and 8 deletions

View file

@ -71,7 +71,7 @@ def root(args, cmd, suffix="native", working_dir="/", output="log",
executables = executables_absolute_path()
cmd_chroot = [executables["chroot"], chroot, "/bin/sh", "-c",
pmb.helpers.run.flat_cmd(cmd, working_dir)]
cmd_sudo = ["sudo", "env", "-i", executables["sh"], "-c",
cmd_sudo = [pmb.config.sudo, "env", "-i", executables["sh"], "-c",
pmb.helpers.run.flat_cmd(cmd_chroot, env=env_all)]
return pmb.helpers.run_core.core(args, msg, cmd_sudo, None, output,
output_return, check, True,