Skip to content

Commit 8c4bbcb

Browse files
author
Kenth Fagerlund
committed
fix(install): gracefully fallback to ~/.local/bin in non-interactive environments
1 parent b3ecb32 commit 8c4bbcb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

install.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ echo "📦 Extracting binary..."
5757
tar -xzf "${TMP_DIR}/${TARBALL}" -C "${TMP_DIR}"
5858

5959
# Determine installation directory
60-
INSTALL_DIR="/usr/local/bin"
60+
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
61+
USE_SUDO=""
62+
6163
if [ ! -w "${INSTALL_DIR}" ]; then
62-
if command -v sudo >/dev/null 2>&1; then
64+
if [ -t 0 ] && command -v sudo >/dev/null 2>&1; then
6365
USE_SUDO="sudo"
6466
else
6567
INSTALL_DIR="${HOME}/.local/bin"

0 commit comments

Comments
 (0)