fix $SUDO detection: skip when root, check doas.conf exists
On OpenBSD the doas binary exists but /etc/doas.conf may not, causing 'doas is not enabled' errors. Now checks: root → no sudo needed, doas + config exists → use doas, sudo available → use sudo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9af745427e
commit
b957dc3c90
@ -36,8 +36,10 @@ PAD_LEN=4
|
||||
BASE_PACKAGES="gnupg curl wget git"
|
||||
ACT_PACKAGES="ripgrep unzip htop fzf bat gawk jq nnn tmux mc nethogs ngrep mtr gcc"
|
||||
|
||||
# Prefer doas over sudo (FreeBSD)
|
||||
if command -v doas >/dev/null 2>&1; then
|
||||
# Prefer doas over sudo (FreeBSD/OpenBSD), skip if already root
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
SUDO=""
|
||||
elif command -v doas >/dev/null 2>&1 && [ -f /etc/doas.conf ]; then
|
||||
SUDO="doas"
|
||||
elif command -v sudo >/dev/null 2>&1; then
|
||||
SUDO="sudo"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user