From 02483d8bc7e2faba3467477eff203e62b7f08a23 Mon Sep 17 00:00:00 2001 Date: Tue, 15 Dec 2020 12:45:04 +0000 Subject: [PATCH] Add doas support if sudo binary is not found --- scripts/libmakepkg/executable/sudo.sh.in | 4 ++-- scripts/makepkg.sh.in | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/libmakepkg/executable/sudo.sh.in b/scripts/libmakepkg/executable/sudo.sh.in index 9e50a76b..a92727ea 100644 --- a/scripts/libmakepkg/executable/sudo.sh.in +++ b/scripts/libmakepkg/executable/sudo.sh.in @@ -29,8 +29,8 @@ executable_functions+=('executable_sudo') executable_sudo() { if (( DEP_BIN || RMDEPS || INSTALL )); then - if ! type -p sudo >/dev/null; then - warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su" + if ! type -p sudo >/dev/null && ! type -p doas >/dev/null; then + warning "$(gettext "Cannot find the %s or %s binaries. Will use %s to acquire root privileges.")" "sudo" "doas" "su" fi fi } diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index b39433f3..47b3001d 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -232,6 +232,8 @@ run_pacman() { cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@") if type -p sudo >/dev/null; then cmd=(sudo "${cmd[@]}") + elif type -p doas >/dev/null; then + cmd=(doas "${cmd[@]}") else cmd=(su root -c "$(printf '%q ' "${cmd[@]}")") fi -- 2.29.2