-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinstall.sh
More file actions
116 lines (102 loc) · 4.92 KB
/
Copy pathinstall.sh
File metadata and controls
116 lines (102 loc) · 4.92 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
#!/usr/bin/env bash
# Kompl one-line installer for Mac / Linux / WSL / Git Bash on Windows.
#
# Usage (the friendly path):
# curl -fsSL https://raw.githubusercontent.com/tuirk/Kompl/main/install.sh | bash
#
# Usage (download and inspect first — recommended for security-conscious users):
# curl -fsSLO https://raw.githubusercontent.com/tuirk/Kompl/main/install.sh
# less install.sh
# bash install.sh
#
# Optional argument: target directory name (defaults to "kompl"):
# bash install.sh my-kompl
set -euo pipefail
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
BOLD='\033[1m'
RESET='\033[0m'
ok() { printf " ${GREEN}\xe2\x9c\x93${RESET} %s\n" "$1"; }
warn() { printf " ${YELLOW}!${RESET} %s\n" "$1"; }
fail() { printf " ${RED}\xe2\x9c\x97${RESET} %s\n" "$1"; exit 1; }
printf "\n${BOLD}Kompl — installer${RESET}\n\n"
# ── OS detect ───────────────────────────────────────────────────────────────
case "$(uname -s)" in
Linux*) OS=linux ;;
Darwin*) OS=mac ;;
MINGW*|MSYS*|CYGWIN*) OS=windows-bash ;;
*) fail "Unsupported OS: $(uname -s). Use install.ps1 on native Windows PowerShell." ;;
esac
ok "OS: $OS"
# ── Docker ──────────────────────────────────────────────────────────────────
if ! command -v docker >/dev/null 2>&1; then
case "$OS" in
mac|windows-bash) fail "Docker not installed. Install Docker Desktop: https://www.docker.com/products/docker-desktop/" ;;
linux) fail "Docker not installed. Install Docker Engine + Compose plugin: https://docs.docker.com/engine/install/" ;;
esac
fi
if ! docker info >/dev/null 2>&1; then
fail "Docker is installed but not running. Start Docker Desktop (or 'sudo systemctl start docker' on Linux), then re-run."
fi
ok "Docker running"
if ! docker compose version >/dev/null 2>&1; then
fail "Docker Compose v2 not available. Install the compose plugin: https://docs.docker.com/compose/install/"
fi
ok "Docker Compose v2"
# ── Node.js ─────────────────────────────────────────────────────────────────
if ! command -v node >/dev/null 2>&1; then
printf "\n"
warn "Node.js not installed. Install Node 24 first:"
case "$OS" in
mac) printf " %s\n" "brew install node@24 # or download from https://nodejs.org/" ;;
linux) printf " %s\n" "Use nvm (https://github.com/nvm-sh/nvm) and run: nvm install 24" ;;
windows-bash) printf " %s\n" "winget install OpenJS.NodeJS # in PowerShell, or download https://nodejs.org/" ;;
esac
exit 1
fi
NODE_RAW=$(node --version)
NODE_MAJOR=$(printf "%s" "$NODE_RAW" | sed 's/v\([0-9]*\).*/\1/')
if [ "${NODE_MAJOR:-0}" -lt 24 ]; then
fail "Node ≥ 24 required (you have $NODE_RAW). Upgrade via nvm or your installer, then re-run."
fi
ok "Node $NODE_RAW"
# ── Disk & RAM ──────────────────────────────────────────────────────────────
DISK_MB=$(df -m . 2>/dev/null | awk 'NR==2 {print $4}' || echo 0)
if [ -n "${DISK_MB:-}" ] && [ "$DISK_MB" -gt 0 ]; then
if [ "$DISK_MB" -lt 5120 ]; then
warn "Low disk space: $((DISK_MB / 1024)) GB free here. Recommended: 5 GB+ for Docker images."
else
ok "Disk: $((DISK_MB / 1024)) GB free"
fi
fi
RAM_MB=0
case "$OS" in
linux)
RAM_MB=$(awk '/MemAvailable/ {print int($2/1024)}' /proc/meminfo 2>/dev/null || echo 0)
;;
mac)
RAM_MB=$(($(sysctl -n hw.memsize 2>/dev/null || echo 0) / 1024 / 1024))
;;
esac
if [ "$RAM_MB" -gt 0 ]; then
if [ "$RAM_MB" -lt 4096 ]; then
warn "Low RAM: $((RAM_MB / 1024)) GB. Kompl needs ~4 GB; expect slowness or container OOMs."
else
ok "RAM: $((RAM_MB / 1024)) GB"
fi
fi
# ── Clone ───────────────────────────────────────────────────────────────────
TARGET="${1:-kompl}"
if [ -e "$TARGET" ]; then
fail "'$TARGET' already exists. Pass a different name: bash install.sh my-kompl"
fi
printf "\n Cloning into ./%s ...\n" "$TARGET"
if ! git clone --depth=1 https://github.com/tuirk/Kompl.git "$TARGET" >/dev/null 2>&1; then
fail "git clone failed. Is git installed? Network OK?"
fi
ok "Cloned"
# ── Hand off to setup.js ────────────────────────────────────────────────────
cd "$TARGET"
printf "\n Handing off to setup.js (interactive — needs Firecrawl plus Gemini or DeepSeek; YouTube prompt is optional).\n\n"
exec node setup.js