-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·54 lines (48 loc) · 1.59 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·54 lines (48 loc) · 1.59 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
54
#!/bin/sh
# orbit-diff installer.
# curl -fsSL https://raw.githubusercontent.com/Diagonal-HQ/orbit-diff/main/install.sh | sh
#
# Downloads the latest release binary for this platform and installs it to
# $ORBIT_DIFF_BIN_DIR (default ~/.local/bin).
set -eu
REPO="Diagonal-HQ/orbit-diff"
BIN_DIR="${ORBIT_DIFF_BIN_DIR:-$HOME/.local/bin}"
os="$(uname -s)"
arch="$(uname -m)"
case "$os" in
Darwin)
case "$arch" in
arm64 | aarch64) asset="orbit-diff-darwin-arm64" ;;
*) echo "orbit-diff: no prebuilt binary for macOS $arch (only Apple Silicon is published)." >&2; exit 1 ;;
esac ;;
Linux)
case "$arch" in
x86_64 | amd64) asset="orbit-diff-linux-x64" ;;
arm64 | aarch64) asset="orbit-diff-linux-arm64" ;;
*) echo "orbit-diff: no prebuilt binary for Linux $arch." >&2; exit 1 ;;
esac ;;
*)
echo "orbit-diff: unsupported OS '$os'." >&2; exit 1 ;;
esac
url="https://github.com/$REPO/releases/latest/download/$asset"
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
echo "Downloading ${asset}..."
if command -v curl >/dev/null 2>&1; then
curl -fL --progress-bar "$url" -o "$tmp"
elif command -v wget >/dev/null 2>&1; then
wget -qO "$tmp" "$url"
else
echo "orbit-diff: need curl or wget to download." >&2; exit 1
fi
mkdir -p "$BIN_DIR"
chmod +x "$tmp"
mv "$tmp" "$BIN_DIR/orbit-diff"
trap - EXIT
echo "Installed orbit-diff → $BIN_DIR/orbit-diff"
case ":$PATH:" in
*":$BIN_DIR:"*) ;;
*) echo "Note: $BIN_DIR is not on your PATH. Add this to your shell profile:"
echo " export PATH=\"$BIN_DIR:\$PATH\"" ;;
esac
echo "Run 'orbit-diff update' later to upgrade in place."