forked from rtk-ai/rtk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-local.sh
More file actions
executable file
·37 lines (30 loc) · 1002 Bytes
/
Copy pathinstall-local.sh
File metadata and controls
executable file
·37 lines (30 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# Install RTK from a local release build (builds from source, no network download).
set -euo pipefail
INSTALL_DIR="${1:-$HOME/.cargo/bin}"
INSTALL_PATH="${INSTALL_DIR}/rtk"
BINARY_PATH="./target/release/rtk"
if ! command -v cargo &>/dev/null; then
echo "error: cargo not found"
echo "install Rust: https://rustup.rs"
exit 1
fi
echo "installing to: $INSTALL_DIR"
if [ -f "$BINARY_PATH" ] && [ -z "$(find src/ Cargo.toml Cargo.lock -newer "$BINARY_PATH" -print -quit 2>/dev/null)" ]; then
echo "binary is up to date"
else
echo "building rtk (release)..."
cargo build --release
fi
mkdir -p "$INSTALL_DIR"
install -m 755 "$BINARY_PATH" "$INSTALL_PATH"
echo "installed: $INSTALL_PATH"
echo "version: $("$INSTALL_PATH" --version)"
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*) echo
echo "warning: $INSTALL_DIR is not in your PATH"
echo "add this to your shell profile:"
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
;;
esac