script support for doas added (actually now)
This commit is contained in:
parent
a3d6154ae6
commit
7638fac97b
1 changed files with 9 additions and 3 deletions
|
|
@ -13,7 +13,6 @@
|
||||||
# ./install-dependencies-deb.sh --no-build # install deps + npm install only
|
# ./install-dependencies-deb.sh --no-build # install deps + npm install only
|
||||||
# ./install-dependencies-deb.sh --no-npm # system packages only
|
# ./install-dependencies-deb.sh --no-npm # system packages only
|
||||||
#
|
#
|
||||||
alias sudo=doas
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
MIN_NODE_MAJOR=20
|
MIN_NODE_MAJOR=20
|
||||||
|
|
@ -66,12 +65,19 @@ case "${ID:-}${ID_LIKE:-}" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# --- root / sudo helper ---------------------------------------------------
|
# --- root / sudo helper ---------------------------------------------------
|
||||||
|
# Prefer sudo when present, otherwise fall back to OpenDoas (doas).
|
||||||
|
SUDO=""
|
||||||
|
SUDO_ENV_FLAG=""
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
SUDO=""
|
SUDO=""
|
||||||
elif command -v sudo >/dev/null 2>&1; then
|
elif command -v sudo >/dev/null 2>&1; then
|
||||||
SUDO="sudo"
|
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
|
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
|
fi
|
||||||
|
|
||||||
# --- system packages ------------------------------------------------------
|
# --- system packages ------------------------------------------------------
|
||||||
|
|
@ -108,7 +114,7 @@ else
|
||||||
warn "Node.js $(node -v) is too old for Next.js 16; installing current LTS."
|
warn "Node.js $(node -v) is too old for Next.js 16; installing current LTS."
|
||||||
fi
|
fi
|
||||||
log "Installing Node.js LTS from NodeSource"
|
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
|
$SUDO apt-get install -y nodejs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue