-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·67 lines (54 loc) · 1.95 KB
/
install.sh
File metadata and controls
executable file
·67 lines (54 loc) · 1.95 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
#!/usr/bin/env bash
set -euo pipefail
# Oracle installer — clones, builds, and symlinks the oracle command.
# Usage: curl -fsSL https://raw.githubusercontent.com/productioneer/oracle/main/install.sh | bash
INSTALL_DIR="${ORACLE_INSTALL_DIR:-$HOME/.oracle/app}"
BIN_DIR="${ORACLE_BIN_DIR:-/usr/local/bin}"
# --- Prerequisites ---
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "Error: Oracle currently supports macOS only."
exit 1
fi
if ! command -v git >/dev/null 2>&1; then
echo "Error: git is required but not found. Install Xcode Command Line Tools: xcode-select --install"
exit 1
fi
if ! command -v node >/dev/null 2>&1; then
echo "Error: Node.js is required but not found. Install it from https://nodejs.org/ (v22+)."
exit 1
fi
NODE_MAJOR=$(node -e 'console.log(process.versions.node.split(".")[0])')
if [ "$NODE_MAJOR" -lt 22 ] 2>/dev/null; then
echo "Error: Node.js v22+ is required (found v$(node -v)). Upgrade from https://nodejs.org/"
exit 1
fi
# --- Install ---
echo "Installing Oracle to $INSTALL_DIR..."
if [ -d "$INSTALL_DIR" ]; then
if [ -d "$INSTALL_DIR/.git" ]; then
echo "Updating existing installation..."
git -C "$INSTALL_DIR" pull --ff-only
else
echo "Error: $INSTALL_DIR exists but is not a git repository."
echo "Remove it manually and re-run the installer: rm -rf $INSTALL_DIR"
exit 1
fi
else
git clone https://github.com/productioneer/oracle.git "$INSTALL_DIR"
fi
cd "$INSTALL_DIR"
npm install --no-fund --no-audit
npx playwright install chromium
npm run build
# Create symlink (may need sudo on some systems)
mkdir -p "$BIN_DIR" 2>/dev/null || true
if [ -w "$BIN_DIR" ]; then
ln -sf "$INSTALL_DIR/dist/cli.js" "$BIN_DIR/oracle"
else
echo "Creating symlink requires elevated permissions:"
sudo mkdir -p "$BIN_DIR"
sudo ln -sf "$INSTALL_DIR/dist/cli.js" "$BIN_DIR/oracle"
fi
echo ""
echo "Oracle installed successfully!"
echo "Run 'oracle open' to log in to ChatGPT, then 'oracle run' to start querying."