forked from dora-rs/dora
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·49 lines (40 loc) · 1.4 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.4 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env sh
# Install the Dora CLI binary from GitHub Releases.
# Usage: curl -fsSL https://github.com/dora-rs/dora/releases/latest/download/dora-cli-installer.sh | sh
set -eu
REPO="dora-rs/dora"
DEST="$HOME/.dora/bin"
# Resolve latest tag
tag=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | cut -d'"' -f4)
# Detect target triple
case "$(uname -m)-$(uname -s)" in
aarch64-Linux) target=aarch64-unknown-linux-gnu ;;
arm64-Darwin) target=aarch64-apple-darwin ;;
x86_64-Darwin) target=x86_64-apple-darwin ;;
x86_64-Linux) target=x86_64-unknown-linux-gnu ;;
*) echo "Unsupported platform: $(uname -m)-$(uname -s)" >&2; exit 1 ;;
esac
archive="https://github.com/$REPO/releases/download/$tag/dora-$target.tar.gz"
echo "Installing dora $tag ($target) to $DEST"
# Download, extract, install
mkdir -p "$DEST"
curl -fsSL "$archive" | tar -xz -C "$DEST" dora
chmod 755 "$DEST/dora"
# Add to PATH if not already there
add_to_rc() {
rc="$1"
if [ -f "$rc" ] && grep -q "$DEST" "$rc"; then
return
fi
echo "export PATH=\"\$PATH:$DEST\"" >> "$rc"
echo "Added $DEST to PATH in $rc (restart your shell or run: source $rc)"
}
case "${SHELL:-}" in
*/bash) add_to_rc "$HOME/.bashrc" ;;
*/zsh) add_to_rc "$HOME/.zshrc" ;;
*)
echo "Add this to your shell profile:"
echo " export PATH=\"\$PATH:$DEST\""
;;
esac
echo "Done! Run 'dora --version' to verify."