Skip to content

Commit

Permalink
Add doas support to is_root_or_sudo_prefix
Browse files Browse the repository at this point in the history
doas is not compatible with sudo flags. The codebase was checked for
sudo-specific uses of this function, but none were found, all cases were
in the form of `sudo <command>`. Replacing it with `doas <command>`
yields the same result.
  • Loading branch information
JohnTheCoolingFan committed May 11, 2024
1 parent 18e6552 commit bb4e1cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/functions/host/host-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ function is_root_or_sudo_prefix() {
# sudo binary found in path, use it.
display_alert "EUID is not 0" "sudo binary found, using it" "debug"
__my_sudo_prefix="sudo"
elif [[ -n "$(command -v doas)" ]]; then
# doas binary found in path, use it.
display_alert "EUID is not 0" "doas binary found, using it" "debug"
__my_sudo_prefix="sudo"
else
# No root and no sudo binary. Bail out
exit_with_error "EUID is not 0 and no sudo binary found - Please install sudo or run as root"
Expand Down

0 comments on commit bb4e1cc

Please sign in to comment.