-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·67 lines (56 loc) · 2.07 KB
/
install.sh
File metadata and controls
executable file
·67 lines (56 loc) · 2.07 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
# SPARK One-line Installer Script
# Usage: curl -fsSL https://raw.githubusercontent.com/user/spark/main/install.sh | bash
set -e
REPO_URL="https://github.com/securezeron/spark.git"
INSTALL_DIR="$HOME/.spark"
BIN_DIR="$HOME/.local/bin"
echo -e "\n\033[1;36m🔥 SPARK Installer\033[0m"
echo -e "========================\n"
# 1. Check prerequisites
command -v python3 >/dev/null 2>&1 || { echo >&2 "❌ Error: python3 is required but not installed. Aborting."; exit 1; }
command -v go >/dev/null 2>&1 || { echo >&2 "❌ Error: go is required but not installed. Aborting."; exit 1; }
command -v git >/dev/null 2>&1 || { echo >&2 "❌ Error: git is required but not installed. Aborting."; exit 1; }
# 2. Clone repository
echo "📥 Cloning repository into $INSTALL_DIR..."
if [ -d "$INSTALL_DIR" ]; then
echo "⚠️ Directory $INSTALL_DIR already exists. Pulling latest changes..."
cd "$INSTALL_DIR"
git pull origin main || true
else
git clone "$REPO_URL" "$INSTALL_DIR"
cd "$INSTALL_DIR"
fi
# 3. Setup Virtual Environment and Dependencies
echo "🐍 Setting up Python virtual environment..."
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip --quiet
echo "📦 Installing Python dependencies..."
pip install -r requirements.txt --quiet
deactivate
# 4. Compile Go crawler
echo "🐹 Compiling Go crawler..."
go build -o scraper scraper.go
# 5. Setup environment file if not exists
if [ ! -f ".env" ]; then
echo "⚙️ Copying default .env.example to .env..."
cp .env.example .env
fi
# 6. Create alias/symlink
echo "🔗 Setting up global command..."
mkdir -p "$BIN_DIR"
cat << 'EOF' > "$BIN_DIR/spark"
#!/usr/bin/env bash
# SPARK global executable launcher
cd ~/.spark
source .venv/bin/activate
python app.py "$@"
deactivate
EOF
chmod +x "$BIN_DIR/spark"
echo -e "\n\033[1;32m✅ Installation Complete!\033[0m"
echo -e "\033[1;33mPlease assure $BIN_DIR is in your PATH.\033[0m"
echo "You can now run SPARK from anywhere using:"
echo -e "\n spark \"Vendor Name\" \"domain.com\""
echo -e "\nTo configure AI keys, edit: $INSTALL_DIR/.env\n"