feat: add doas support (#5600)

Some people may have some reason to drop sudo and switch to doas
This commit is contained in:
unknowndevQwQ 2022-10-05 00:45:25 +08:00 committed by GitHub
parent 77bbed4831
commit 3a9eb312b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -553,6 +553,8 @@ sh_c() {
sudo_sh_c() { sudo_sh_c() {
if [ "$(id -u)" = 0 ]; then if [ "$(id -u)" = 0 ]; then
sh_c "$@" sh_c "$@"
elif command_exists doas; then
sh_c "doas $*"
elif command_exists sudo; then elif command_exists sudo; then
sh_c "sudo $*" sh_c "sudo $*"
elif command_exists su; then elif command_exists su; then
@ -561,7 +563,7 @@ sudo_sh_c() {
echoh echoh
echoerr "This script needs to run the following command as root." echoerr "This script needs to run the following command as root."
echoerr " $*" echoerr " $*"
echoerr "Please install sudo or su." echoerr "Please install doas, sudo, or su."
exit 1 exit 1
fi fi
} }