forked from codecoradev/cora-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-bundle.sh
More file actions
executable file
·115 lines (97 loc) · 3.37 KB
/
Copy pathinstall-bundle.sh
File metadata and controls
executable file
·115 lines (97 loc) · 3.37 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env sh
#
# cora code review — standalone installer
# Installs Cora (AI code review) in one command.
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/codecoradev/cora-code/main/install-bundle.sh | sh
#
set -eu
# ── Config ──────────────────────────────────────────────────────────
REPO_OWNER="codecoradev"
REPO_NAME="cora-code"
BINARY_NAME="cora"
INSTALL_DIR="$HOME/.local/bin"
# Detect platform
detect_platform() {
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux*) OS="linux" ;;
Darwin*) OS="macos" ;;
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
case "$ARCH" in
x86_64|amd64) ARCH="x86_64" ;;
aarch64|arm64) ARCH="aarch64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
PLATFORM="${OS}-${ARCH}"
}
# Get latest release tag from GitHub
get_latest_version() {
VERSION="$(curl -fsSL "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest" \
| grep '"tag_name"' \
| head -1 \
| sed -E 's/.*"([^"]+)".*/\1/')"
if [ -z "$VERSION" ]; then
# Fallback: try CORA_VERSION env var
VERSION="${CORA_VERSION:-}"
if [ -z "$VERSION" ]; then
echo "Error: Could not determine latest version."
echo "Set CORA_VERSION env var to install a specific version:"
echo " CORA_VERSION=v0.6.1 $0"
exit 1
fi
fi
echo "$VERSION"
}
# Download and install
install_binary() {
VERSION="$1"
echo "cora installer"
echo " Version: ${VERSION}"
echo " Platform: ${PLATFORM}"
echo " Install to: ${INSTALL_DIR}/${BINARY_NAME}"
echo ""
# Create install directory
mkdir -p "$INSTALL_DIR"
# Download URL
URL="https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/download/${VERSION}/${BINARY_NAME}-${PLATFORM}"
echo "Downloading ${BINARY_NAME} ${VERSION}..."
curl -fsSL "$URL" -o "${INSTALL_DIR}/${BINARY_NAME}"
# Make executable
chmod +x "${INSTALL_DIR}/${BINARY_NAME}"
# Strip quarantine attributes on macOS
if [ "$(uname -s)" = "Darwin" ]; then
xattr -dr com.apple.quarantine "${INSTALL_DIR}/${BINARY_NAME}" 2>/dev/null || true
xattr -dr com.apple.provenance "${INSTALL_DIR}/${BINARY_NAME}" 2>/dev/null || true
fi
echo ""
echo "✅ ${BINARY_NAME} ${VERSION} installed to ${INSTALL_DIR}/${BINARY_NAME}"
echo ""
echo "Verify:"
echo " ${INSTALL_DIR}/${BINARY_NAME} --version"
echo ""
}
# Verify installation
verify_install() {
if ! command -v "$BINARY_NAME" >/dev/null 2>&1; then
echo "⚠️ ${BINARY_NAME} installed but not on PATH."
echo " Add this to your shell profile:"
echo ""
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
echo ""
else
VERSION="$("${BINARY_NAME}" --version 2>/dev/null || echo "unknown")"
echo "✅ $(which "$BINARY_NAME") — ${VERSION}"
fi
}
# ── Main ───────────────────────────────────────────────────────────
main() {
detect_platform
VERSION="$(get_latest_version)"
install_binary "$VERSION"
verify_install
}
main "$@"