Skip to content

Commit 8c63c92

Browse files
Update install.sh
1 parent 851d490 commit 8c63c92

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

install.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
set -euo pipefail
33

44
TOROT_VERSION="4.0.0"
5-
BINARY_URL="https://github.com/torot/torot/releases/download/v${TOROT_VERSION}/torot-$(uname -s)-$(uname -m).tar.gz"
6-
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
5+
BINARY_URL="https://github.com/Chintanpatel24/torot/releases/download/v${TOROT_VERSION}/torot-$(uname -s)-$(uname -m).tar.gz"
6+
7+
if [ "$(id -u)" -ne 0 ] && [ -w "/usr/local/bin" ]; then
8+
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
9+
else
10+
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
11+
fi
12+
13+
mkdir -p "$INSTALL_DIR"
714

815
info() { printf "\033[32m->\033[0m %s\n" "$*"; }
916
warn() { printf "\033[33m!\033[0m %s\n" "$*"; }
@@ -13,6 +20,7 @@ if [ -f "target/release/torot" ]; then
1320
info "Found local release build, installing..."
1421
install -m 755 target/release/torot "${INSTALL_DIR}/torot"
1522
info "Installed torot to ${INSTALL_DIR}/torot"
23+
info "Make sure ${INSTALL_DIR} is in your PATH"
1624
exit 0
1725
fi
1826

@@ -21,6 +29,7 @@ if command -v cargo &>/dev/null; then
2129
cargo build --release
2230
install -m 755 target/release/torot "${INSTALL_DIR}/torot"
2331
info "Installed torot to ${INSTALL_DIR}/torot"
32+
info "Make sure ${INSTALL_DIR} is in your PATH"
2433
exit 0
2534
fi
2635

0 commit comments

Comments
 (0)