-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·53 lines (48 loc) · 1.68 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·53 lines (48 loc) · 1.68 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
51
52
53
#!/bin/sh
set -eu
repo="${RAVEL_REPO:-12vault/ravel}"
version="${RAVEL_VERSION:-latest}"
install_dir="${RAVEL_INSTALL_DIR:-$HOME/.local/bin}"
case "$(uname -s)" in
Darwin) os=darwin ;;
Linux) os=linux ;;
*) echo "ravel: unsupported operating system" >&2; exit 1 ;;
esac
case "$(uname -m)" in
x86_64|amd64) arch=amd64 ;;
arm64|aarch64) arch=arm64 ;;
*) echo "ravel: unsupported architecture" >&2; exit 1 ;;
esac
if [ "$version" = latest ]; then
base="https://github.com/$repo/releases/latest/download"
else
base="https://github.com/$repo/releases/download/$version"
fi
asset="ravel_${os}_${arch}.tar.gz"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT INT TERM
curl --fail --location --proto '=https' --tlsv1.2 "$base/$asset" --output "$tmp/$asset"
curl --fail --location --proto '=https' --tlsv1.2 "$base/checksums.txt" --output "$tmp/checksums.txt"
(cd "$tmp" && grep " $asset\$" checksums.txt | shasum -a 256 -c -)
tar -xzf "$tmp/$asset" -C "$tmp" ravel
mkdir -p "$install_dir"
install -m 0755 "$tmp/ravel" "$install_dir/ravel"
echo "Installed ravel to $install_dir/ravel"
# The new binary refreshes only Ravel-owned skills and project instructions
# that were already installed. Fresh installations remain opt-in.
"$install_dir/ravel" version >/dev/null
case ":${PATH:-}:" in
*":$install_dir:"*) ;;
*)
echo ""
echo "ravel: $install_dir is not on PATH." >&2
echo "Run this now:" >&2
printf ' export PATH="%s:$PATH"\n' "$install_dir" >&2
case "${SHELL:-}" in
*/zsh) profile="$HOME/.zshrc" ;;
*/bash) profile="$HOME/.bashrc" ;;
*) profile="your shell profile" ;;
esac
echo "Then add the same line to $profile and open a new terminal." >&2
;;
esac