From efdd5d5a0cbd6a4b274a3d69677e61f620c21558 Mon Sep 17 00:00:00 2001 From: unknowndevQwQ Date: Sun, 16 Oct 2022 10:18:30 +0800 Subject: [PATCH] feat: add doas support (#4531) * feat: add doas support Some people may have some reason to drop sudo and switch to doas * chore: doas at the end Just because it is relatively cold :-( Co-authored-by: Kyle Carberry * chore(CI): add doas to pass CI * fix syntax error Co-authored-by: Kyle Carberry Co-authored-by: Ben --- .github/workflows/typos.toml | 2 ++ install.sh | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/typos.toml b/.github/workflows/typos.toml index 90b0ea1cc9..f3d22513ac 100644 --- a/.github/workflows/typos.toml +++ b/.github/workflows/typos.toml @@ -5,6 +5,8 @@ IST = "IST" MacOS = "macOS" [default.extend-words] +# do as sudo replacement +doas = "doas" [files] extend-exclude = [ diff --git a/install.sh b/install.sh index bbecb4d598..bac333cf93 100755 --- a/install.sh +++ b/install.sh @@ -531,6 +531,8 @@ sh_c() { sudo_sh_c() { if [ "$(id -u)" = 0 ]; then sh_c "$@" + elif command_exists doas; then + sh_c "doas $*" elif command_exists sudo; then sh_c "sudo $*" elif command_exists su; then @@ -539,7 +541,7 @@ sudo_sh_c() { echoh echoerr "This script needs to run the following command as root." echoerr " $*" - echoerr "Please install sudo or su." + echoerr "Please install sudo, su, or doas." exit 1 fi }