mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
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 <kyle@carberry.com> * chore(CI): add doas to pass CI * fix syntax error Co-authored-by: Kyle Carberry <kyle@carberry.com> Co-authored-by: Ben <me@bpmct.net>
This commit is contained in:
@@ -5,6 +5,8 @@ IST = "IST"
|
||||
MacOS = "macOS"
|
||||
|
||||
[default.extend-words]
|
||||
# do as sudo replacement
|
||||
doas = "doas"
|
||||
|
||||
[files]
|
||||
extend-exclude = [
|
||||
|
||||
+3
-1
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user