diff --git a/run_onchange_after_install_main_deps.sh.tmpl b/run_onchange_after_install_main_deps.sh.tmpl index 39ea8bc..71819d8 100644 --- a/run_onchange_after_install_main_deps.sh.tmpl +++ b/run_onchange_after_install_main_deps.sh.tmpl @@ -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"