-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
168 lines (144 loc) · 4.49 KB
/
install.sh
File metadata and controls
168 lines (144 loc) · 4.49 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
#
# Gorev Installation Script
# https://github.com/msenol/Gorev
#
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Variables
REPO="msenol/Gorev"
VERSION="${VERSION:-v0.15.4}"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
DATA_DIR="${DATA_DIR:-$HOME/.gorev}"
# Detect OS and Architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
# Map architecture names
case $ARCH in
x86_64)
ARCH="amd64"
;;
arm64|aarch64)
echo -e "${RED}ARM architecture not supported yet${NC}"
exit 1
;;
*)
echo -e "${RED}Unsupported architecture: $ARCH${NC}"
exit 1
;;
esac
# Set binary name
BINARY_NAME="gorev-${OS}-${ARCH}"
if [ "$OS" = "windows" ]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
echo -e "${GREEN}Installing Gorev ${VERSION}...${NC}"
echo "OS: $OS"
echo "Architecture: $ARCH"
echo "Binary: $BINARY_NAME"
echo "Install directory: $INSTALL_DIR"
echo "Data directory: $DATA_DIR"
# Create temp directory
TEMP_DIR=$(mktemp -d)
trap "rm -rf $TEMP_DIR" EXIT
# Download binary
DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${VERSION}/${BINARY_NAME}"
echo -e "${YELLOW}Downloading from ${DOWNLOAD_URL}...${NC}"
curl -L -o "$TEMP_DIR/gorev" "$DOWNLOAD_URL" || {
echo -e "${RED}Failed to download gorev${NC}"
exit 1
}
# Make executable
chmod +x "$TEMP_DIR/gorev"
# Create data directory
echo -e "${YELLOW}Creating data directory at ${DATA_DIR}...${NC}"
mkdir -p "$DATA_DIR"
# Download and extract source for migrations
echo -e "${YELLOW}Downloading migrations and data files...${NC}"
SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/${VERSION}.tar.gz"
curl -L -o "$TEMP_DIR/source.tar.gz" "$SOURCE_URL" || {
echo -e "${RED}Failed to download source files${NC}"
exit 1
}
# Extract source
tar -xzf "$TEMP_DIR/source.tar.gz" -C "$TEMP_DIR"
# Find the extracted directory (it will be named Gorev-VERSION without 'v' prefix)
VERSION_WITHOUT_V=${VERSION#v}
SOURCE_DIR="$TEMP_DIR/Gorev-${VERSION_WITHOUT_V}"
if [ ! -d "$SOURCE_DIR" ]; then
# Try alternative naming
SOURCE_DIR=$(find "$TEMP_DIR" -maxdepth 1 -type d -name "Gorev-*" | head -1)
fi
if [ ! -d "$SOURCE_DIR" ]; then
echo -e "${RED}Failed to find source directory${NC}"
exit 1
fi
# Copy migrations
echo -e "${YELLOW}Copying migration files...${NC}"
mkdir -p "$DATA_DIR/internal/veri"
cp -r "$SOURCE_DIR/gorev-mcpserver/internal/veri/migrations" "$DATA_DIR/internal/veri/" || {
echo -e "${RED}Failed to copy migration files${NC}"
exit 1
}
# Verify binary with new GOREV_ROOT
echo -e "${YELLOW}Verifying binary...${NC}"
export GOREV_ROOT="$DATA_DIR"
"$TEMP_DIR/gorev" version || {
echo -e "${RED}Binary verification failed${NC}"
exit 1
}
# Install binary
echo -e "${YELLOW}Installing binary to ${INSTALL_DIR}...${NC}"
if [ -w "$INSTALL_DIR" ]; then
cp "$TEMP_DIR/gorev" "$INSTALL_DIR/gorev.bin"
else
sudo cp "$TEMP_DIR/gorev" "$INSTALL_DIR/gorev.bin" || {
echo -e "${RED}Failed to install gorev. Try with sudo or change INSTALL_DIR${NC}"
exit 1
}
fi
# Create wrapper script
echo -e "${YELLOW}Creating wrapper script...${NC}"
WRAPPER_CONTENT="#!/bin/bash
# Gorev wrapper script
export GOREV_ROOT=\"$DATA_DIR\"
exec \"$INSTALL_DIR/gorev.bin\" \"\$@\"
"
# Install wrapper
if [ -w "$INSTALL_DIR" ]; then
echo "$WRAPPER_CONTENT" > "$INSTALL_DIR/gorev"
chmod +x "$INSTALL_DIR/gorev"
else
echo "$WRAPPER_CONTENT" | sudo tee "$INSTALL_DIR/gorev" > /dev/null
sudo chmod +x "$INSTALL_DIR/gorev"
fi
echo -e "${GREEN}✓ Gorev installed successfully!${NC}"
echo ""
echo "Installed components:"
echo " Binary: $INSTALL_DIR/gorev"
echo " Data files: $DATA_DIR"
echo ""
echo "Run 'gorev version' to verify installation"
echo "Run 'gorev help' to see available commands"
echo ""
echo "To use with Claude Desktop, VS Code, or other MCP clients,"
echo "see: https://github.com/${REPO}#mcp-editör-entegrasyonu"
# Add to shell profile if not already there
SHELL_PROFILE=""
if [ -n "$ZSH_VERSION" ]; then
SHELL_PROFILE="$HOME/.zshrc"
elif [ -n "$BASH_VERSION" ]; then
SHELL_PROFILE="$HOME/.bashrc"
fi
if [ -n "$SHELL_PROFILE" ] && [ -f "$SHELL_PROFILE" ]; then
if ! grep -q "GOREV_ROOT" "$SHELL_PROFILE"; then
echo ""
echo -e "${YELLOW}Adding GOREV_ROOT to $SHELL_PROFILE...${NC}"
echo "export GOREV_ROOT=\"$DATA_DIR\"" >> "$SHELL_PROFILE"
echo -e "${GREEN}✓ Added to shell profile. Run 'source $SHELL_PROFILE' or restart your terminal.${NC}"
fi
fi