-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·57 lines (47 loc) · 1.67 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·57 lines (47 loc) · 1.67 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
#!/usr/bin/env bash
set -euo pipefail
REPO="dyrnq/claw-code-prebuilt-binaries"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
# Detect platform
OS=$(uname -s)
ARCH=$(uname -m)
case "$OS-$ARCH" in
Linux-x86_64) TARGET="x86_64-unknown-linux-gnu"; EXT="" ;;
Linux-aarch64) TARGET="aarch64-unknown-linux-gnu"; EXT="" ;;
Linux-armv7*) TARGET="armv7-unknown-linux-musleabihf"; EXT="" ;;
Darwin-x86_64) TARGET="x86_64-apple-darwin"; EXT="" ;;
Darwin-arm64) TARGET="aarch64-apple-darwin"; EXT="" ;;
*)
echo "Unsupported platform: $OS-$ARCH"
echo "See https://github.com/$REPO/releases for all targets."
exit 1
;;
esac
echo "→ Platform: $TARGET"
# Fetch latest release tag
echo "→ Fetching latest release..."
LATEST_TAG=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_TAG" ]; then
echo "Error: could not determine latest release."
exit 1
fi
echo "→ Latest: $LATEST_TAG"
# Download binary and checksum
BIN_NAME="claw-$TARGET"
DL_BASE="https://github.com/$REPO/releases/download/$LATEST_TAG"
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
echo "→ Downloading $BIN_NAME..."
curl -fsSL "$DL_BASE/$BIN_NAME.tar.zst" -o "$TMPDIR/$BIN_NAME.tar.zst"
curl -fsSL "$DL_BASE/sha256sums.txt" -o "$TMPDIR/sha256sums.txt"
# Verify checksum
echo "→ Verifying checksum..."
cd "$TMPDIR"
tar -xf "$BIN_NAME.tar.zst"
grep "$BIN_NAME\$" sha256sums.txt | sha256sum -c -
# Install
echo "→ Installing to $INSTALL_DIR/claw..."
chmod +x "$BIN_NAME"
sudo mv "$BIN_NAME" "$INSTALL_DIR/claw"
echo "→ Done! claw installed at $INSTALL_DIR/claw"
claw --version 2>/dev/null || true