-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·88 lines (76 loc) · 2.18 KB
/
install.sh
File metadata and controls
executable file
·88 lines (76 loc) · 2.18 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
# DiffScope Installation Script
# This script detects your platform and downloads the appropriate binary
set -e
REPO="evalops/diffscope"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
BINARY_NAME="diffscope"
# Detect OS and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
# Map to Rust target triples
case "$OS" in
linux)
case "$ARCH" in
x86_64)
TARGET="x86_64-unknown-linux-musl"
;;
aarch64)
TARGET="aarch64-unknown-linux-gnu"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
;;
darwin)
case "$ARCH" in
x86_64)
TARGET="x86_64-apple-darwin"
;;
arm64)
TARGET="aarch64-apple-darwin"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
# Get latest release
echo "Fetching latest release..."
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_RELEASE" ]; then
echo "Failed to fetch latest release"
exit 1
fi
echo "Latest release: $LATEST_RELEASE"
# Download URL
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_RELEASE/diffscope-$TARGET"
# Download binary
echo "Downloading $BINARY_NAME for $TARGET..."
TMP_FILE=$(mktemp)
curl -L "$DOWNLOAD_URL" -o "$TMP_FILE"
# Make executable
chmod +x "$TMP_FILE"
# Check if we need sudo
if [ -w "$INSTALL_DIR" ]; then
mv "$TMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
else
echo "Installing to $INSTALL_DIR requires sudo access"
sudo mv "$TMP_FILE" "$INSTALL_DIR/$BINARY_NAME"
fi
# Verify installation
if command -v diffscope >/dev/null 2>&1; then
echo "✅ DiffScope installed successfully!"
echo "Version: $(diffscope --version)"
else
echo "⚠️ Installation completed but diffscope not found in PATH"
echo "You may need to add $INSTALL_DIR to your PATH"
fi