From 7638fac97b41297e619551e177827c89a89d69f2 Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Thu, 24 Sep 2026 07:12:14 +0000 Subject: [PATCH] script support for doas added (actually now) --- install-dependencies-deb.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/install-dependencies-deb.sh b/install-dependencies-deb.sh index d558090..21009e6 100755 --- a/install-dependencies-deb.sh +++ b/install-dependencies-deb.sh @@ -13,7 +13,6 @@ # ./install-dependencies-deb.sh --no-build # install deps + npm install only # ./install-dependencies-deb.sh --no-npm # system packages only # -alias sudo=doas set -euo pipefail MIN_NODE_MAJOR=20 @@ -66,12 +65,19 @@ case "${ID:-}${ID_LIKE:-}" in esac # --- root / sudo helper --------------------------------------------------- +# Prefer sudo when present, otherwise fall back to OpenDoas (doas). +SUDO="" +SUDO_ENV_FLAG="" if [ "$(id -u)" -eq 0 ]; then SUDO="" elif command -v sudo >/dev/null 2>&1; then SUDO="sudo" + SUDO_ENV_FLAG="-E" # sudo resets the environment by default; keep ours +elif command -v doas >/dev/null 2>&1; then + SUDO="doas" + SUDO_ENV_FLAG="" # doas has no -E; it preserves the environment itself else - die "Not root and 'sudo' is not installed. Re-run as root." + die "Not root and neither 'sudo' nor 'doas' is installed. Re-run as root." fi # --- system packages ------------------------------------------------------ @@ -108,7 +114,7 @@ else warn "Node.js $(node -v) is too old for Next.js 16; installing current LTS." fi log "Installing Node.js LTS from NodeSource" - curl -fsSL https://deb.nodesource.com/setup_lts.x | $SUDO -E bash - + curl -fsSL https://deb.nodesource.com/setup_lts.x | $SUDO $SUDO_ENV_FLAG bash - $SUDO apt-get install -y nodejs fi