-
Notifications
You must be signed in to change notification settings - Fork 431
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·50 lines (41 loc) · 1.65 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.65 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
50
#!/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. Releases ship aarch64/x86_64 Linux and aarch64 macOS
# only — no x86_64-apple-darwin asset exists, so Intel Macs get the clear
# unsupported-platform error instead of a confusing download failure.
case "$(uname -m)-$(uname -s)" in
aarch64-Linux) target=aarch64-unknown-linux-gnu ;;
arm64-Darwin) target=aarch64-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-cli-$target.tar.gz"
echo "Installing dora $tag ($target) to $DEST"
# Download, extract, install (archive nests the binary in a dora-cli-<target>/ dir)
mkdir -p "$DEST"
curl -fsSL "$archive" | tar -xz -C "$DEST" --strip-components 1 "dora-cli-$target/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."