-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
71 lines (58 loc) · 1.64 KB
/
install.sh
File metadata and controls
71 lines (58 loc) · 1.64 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
#!/bin/sh
# Cortex installer
# Detects OS and architecture, downloads the correct binary from GitHub Releases.
# Usage: curl -fsSL https://raw.githubusercontent.com/1337Xcode/cortex/main/install.sh | sh
set -e
REPO="1337Xcode/cortex"
INSTALL_DIR="${CORTEX_INSTALL_DIR:-$HOME/.local/bin}"
# Detect OS
case "$(uname -s)" in
Linux*) OS=linux;;
Darwin*) OS=darwin;;
MINGW*|MSYS*|CYGWIN*) OS=win32;;
*) echo "Unsupported OS: $(uname -s)"; exit 1;;
esac
# Detect architecture
case "$(uname -m)" in
x86_64|amd64) ARCH=x64;;
aarch64|arm64) ARCH=arm64;;
*) echo "Unsupported architecture: $(uname -m)"; exit 1;;
esac
BINARY="cortex"
if [ "$OS" = "win32" ]; then
BINARY="cortex.exe"
fi
ARCHIVE="cortex-${OS}-${ARCH}.tar.gz"
URL="https://github.com/${REPO}/releases/latest/download/${ARCHIVE}"
echo "Downloading cortex for ${OS}-${ARCH}..."
echo " From: ${URL}"
# Create install directory
mkdir -p "$INSTALL_DIR"
# Download and extract
if command -v curl >/dev/null 2>&1; then
curl -fsSL "$URL" | tar -xz -C "$INSTALL_DIR"
elif command -v wget >/dev/null 2>&1; then
wget -qO- "$URL" | tar -xz -C "$INSTALL_DIR"
else
echo "Error: need curl or wget"
exit 1
fi
# Make executable
chmod +x "$INSTALL_DIR/$BINARY"
echo ""
echo "Installed cortex to $INSTALL_DIR/$BINARY"
echo ""
# Check if install dir is in PATH
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*)
echo "Add this to your shell profile:"
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
echo ""
;;
esac
echo "Next steps:"
echo " cd /your/project"
echo " cortex index"
echo " cortex install"
echo " cortex serve"