release(v2.0.0): cross-platform release — Linux/macOS/Windows/WSL

Creates full release package with:
- release/install.sh (universal cross-platform installer)
- release/windows/install.bat (Git Bash/MSYS2)
- release/windows/install.ps1 (PowerShell)
- release/homebrew/gyandoot.rb (Homebrew formula)
- release/archives/ prebuilt binary archives
- release/README.md (platform-specific install guide)
- install.sh updated with same cross-platform logic
- README.md updated
This commit is contained in:
2026-06-13 18:35:14 +05:30
parent 3b5b995af8
commit 667336bcb9
9 changed files with 1372 additions and 247 deletions

View File

@@ -1,27 +1,54 @@
#!/usr/bin/env bash
# ═══════════════════════════════════════════════════════════════════════════
# GyanDoot v2.0 — Cross-Platform Universal Installer
# ═══════════════════════════════════════════════════════════════════════════
#
# Detects: macOS (arm64/x86_64), Linux (x86_64/aarch64/i686),
# WSL (Windows Subsystem for Linux), Windows (Git Bash/MSYS2)
#
# Usage:
# curl -fsSL https://git.gyannetra.in/gnpl_admin/gyandoot-release/raw/main/install.sh | bash
#
# Or locally:
# ./install.sh
# ═══════════════════════════════════════════════════════════════════════════
set -euo pipefail
# GyanDoot v2.0 — Cross-platform installer
# Detects OS, architecture, and installs the gyandoot binary + camofox-browser.
# For full documentation, visit: https://git.gyannetra.in/gnpl_admin/gyandoot-v2
# ─── Colors ──────────────────────────────────────────────────────────────
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
CYAN='\033[0;36m'
NC='\033[0m'
info() { echo -e "${BLUE}[INFO]${NC} $*"; }
ok() { echo -e "${GREEN}[OK]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
err() { echo -e "${RED}[ERR]${NC} $*" >&2; exit 1; }
banner() {
echo -e "${CYAN}"
echo ' ____ _ _ _ '
echo ' / ___|_ _ __ _ __| | | |_ ___ __| | ___ '
echo '| | _| | | |/ _` |/ _` | | __/ _ \ / _` |/ _ \ '
echo '| |_| | |_| | (_| | (_| | | |_ (_) | (_| | (_) | '
echo ' \____|\__, |\__,_|\__,_| \__\___/ \__,_|\___/ '
echo ' |___/ '
echo -e "${NC}"
echo -e "${GREEN} GyanDoot v2.0 — Knowledge Messenger${NC}"
echo " Cross-Platform Universal Installer"
echo ""
}
# ─── Platform Detection ──────────────────────────────────────────────────
detect_architecture() {
local arch
arch="$(uname -m)"
case "$arch" in
x86_64|amd64) echo "x86_64" ;;
aarch64|arm64) echo "aarch64" ;;
i686|i386) echo "i686" ;;
*) err "Unsupported architecture: $arch" ;;
esac
}
@@ -37,58 +64,38 @@ detect_os() {
esac
}
# ── WSL Detection ──────────────────────────────────────────────────────────
# Detect if we're running inside Windows Subsystem for Linux.
# /proc/version contains "microsoft" or "wsl" (case-insensitive) on WSL.
detect_wsl() {
if [ -f /proc/version ] && grep -qiE 'microsoft|wsl' /proc/version 2>/dev/null; then
return 0 # true — we are in WSL
return 0
fi
return 1
}
# ── Linux System Dependencies ──────────────────────────────────────────────
# Camoufox (Playwright-based) needs ~30 system libraries on Linux/WSL.
# Without these, the browser daemon crashes silently with
# "Failed to connect: No such file or directory (os error 2)".
# See: https://playwright.dev/docs/troubleshooting#system-dependencies
CAMOUFOX_LINUX_DEPS=(
libgtk-3-0
libnss3
libnspr4
libatk1.0-0t64
libatk-bridge2.0-0t64
libcups2t64
libdrm2
libxkbcommon0
libxcomposite1
libxdamage1
libxfixes3
libxrandr2
libgbm1
libpango-1.0-0
libcairo2
libasound2t64
libxcb-shm0
libx11-xcb1
libx11-6
libxcb1
libxext6
libxcursor1
libxi6
libfreetype6
libfontconfig1
libxshmfence1
libxrender1
libdbus-1-3
)
get_shell_profile() {
case "$SHELL" in
*/zsh) echo "$HOME/.zshrc" ;;
*/bash) echo "$HOME/.bashrc" ;;
*/fish) echo "$HOME/.config/fish/config.fish" ;;
*) echo "$HOME/.profile" ;;
esac
}
# ─── Dependency Installers ───────────────────────────────────────────────
install_rust_if_needed() {
if ! command -v cargo &>/dev/null; then
info "Rust toolchain not found. Installing..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
ok "Rust installed"
if [ "$(uname -s)" = "Darwin" ] || [ "$(uname -s)" = "Linux" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
elif [[ "$(uname -s)" =~ ^(CYGWIN|MINGW|MSYS) ]]; then
# Windows: download rustup-init.exe
powershell -Command "& {Invoke-WebRequest -Uri https://win.rustup.rs -OutFile '%TEMP%\rustup-init.exe'; Start-Process '%TEMP%\rustup-init.exe' -Wait -ArgumentList '-y'}"
export PATH="$PATH:$HOME/.cargo/bin"
else
err "No Rust install method for this platform"
fi
ok "Rust installed ($(cargo --version))"
else
ok "Rust already installed ($(cargo --version))"
fi
@@ -96,43 +103,70 @@ install_rust_if_needed() {
install_node_if_needed() {
if ! command -v node &>/dev/null; then
info "Node.js not found. Installing via nvm..."
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
[ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"
nvm install 22
info "Node.js not found. Installing..."
if command -v nvm &>/dev/null || [ -s "$HOME/.nvm/nvm.sh" ]; then
[ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"
nvm install 22 2>/dev/null || nvm install node
elif [ "$(uname -s)" = "Darwin" ]; then
if command -v brew &>/dev/null; then
brew install node
else
warn "Install Node.js manually: https://nodejs.org"
fi
elif [[ "$(uname -s)" =~ ^(CYGWIN|MINGW|MSYS) ]]; then
warn "Install Node.js from: https://nodejs.org"
else
# Linux: use nvm
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
[ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"
nvm install 22
fi
ok "Node.js installed ($(node --version))"
else
ok "Node.js already installed ($(node --version))"
fi
# Ensure npx is available
if ! command -v npx &>/dev/null; then
warn "npx not found. Installing corepack..."
npm install -g npx 2>/dev/null || true
fi
}
# ── Linux System Deps Installer ────────────────────────────────────────────
# ─── Linux System Dependencies ───────────────────────────────────────────
# Camoufox (Playwright-based) needs these on Linux/WSL
CAMOUFOX_LINUX_DEPS=(
libgtk-3-0 libnss3 libnspr4 libatk1.0-0t64
libatk-bridge2.0-0t64 libcups2t64 libdrm2
libxkbcommon0 libxcomposite1 libxdamage1
libxfixes3 libxrandr2 libgbm1 libpango-1.0-0
libcairo2 libasound2t64 libxcb-shm0
libx11-xcb1 libx11-6 libxcb1 libxext6
libxcursor1 libxi6 libfreetype6 libfontconfig1
libxshmfence1 libxrender1 libdbus-1-3
)
install_linux_deps() {
if [ "$(uname -s)" != "Linux" ]; then
return 0 # Not Linux, skip
return 0
fi
# Check if we're in WSL (Windows Subsystem for Linux)
if detect_wsl; then
info "WSL detected. Checking Linux system dependencies..."
info "WSL detected. Installing Linux system dependencies..."
fi
# Check which packages are already installed
local missing=()
if command -v dpkg-query &>/dev/null; then
for pkg in "${CAMOUFOX_LINUX_DEPS[@]}"; do
if ! dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then
# Handle libasound2 vs libasound2t64 and similar t64 variants
# Try without 't64' suffix as fallback
local alt_pkg="${pkg%t64}"
if [ "$alt_pkg" != "$pkg" ] && dpkg-query -W -f='${Status}' "$alt_pkg" 2>/dev/null | grep -q "install ok installed"; then
continue # alt version is already installed
continue
fi
missing+=("$pkg")
fi
done
else
# Can't check, just try to install all
missing=("${CAMOUFOX_LINUX_DEPS[@]}")
fi
@@ -146,20 +180,14 @@ install_linux_deps() {
if command -v sudo &>/dev/null; then
sudo apt-get update -qq 2>/dev/null || true
sudo apt-get install -y -qq "${missing[@]}" 2>/dev/null || {
# If some packages failed, retry with auto-detected alternatives
warn "Some packages had issues. Retrying with apt --fix..."
warn "Some packages failed. Retrying with fix..."
sudo apt-get --fix-broken install -y -qq 2>/dev/null || true
# Try installing without t64 variants as fallback
local fallback=()
for pkg in "${missing[@]}"; do
local alt="${pkg%t64}"
if [ "$alt" != "$pkg" ]; then
fallback+=("$alt")
fi
[ "$alt" != "$pkg" ] && fallback+=("$alt")
done
if [ ${#fallback[@]} -gt 0 ]; then
sudo apt-get install -y -qq "${fallback[@]}" 2>/dev/null || true
fi
[ ${#fallback[@]} -gt 0 ] && sudo apt-get install -y -qq "${fallback[@]}" 2>/dev/null || true
}
else
apt-get update -qq 2>/dev/null || true
@@ -167,165 +195,149 @@ install_linux_deps() {
fi
ok "Linux system dependencies installed"
elif command -v dnf &>/dev/null; then
info "Detected dnf package manager"
sudo dnf install -y nss nspr atk at-spi2-atk cups-libs libdrm libXcomposite \
libXdamage libXrandr mesa-libgbm pango alsa-lib libxkbcommon libxcb \
libX11-xcb libX11 libXext libXcursor libXfixes libXi gtk3 cairo-gobject 2>/dev/null || true
sudo dnf install -y nss nspr atk at-spi2-atk cups-libs \
libdrm libXcomposite libXdamage libXrandr mesa-libgbm \
pango alsa-lib libxkbcommon libxcb libX11-xcb libX11 \
libXext libXcursor libXfixes libXi gtk3 cairo-gobject 2>/dev/null || true
ok "Linux system dependencies installed"
elif command -v yum &>/dev/null; then
info "Detected yum package manager"
sudo yum install -y nss nspr atk at-spi2-atk cups-libs libdrm libXcomposite \
libXdamage libXrandr mesa-libgbm pango alsa-lib libxkbcommon 2>/dev/null || true
sudo yum install -y nss nspr atk at-spi2-atk cups-libs \
libdrm libXcomposite libXdamage libXrandr mesa-libgbm \
pango alsa-lib libxkbcommon 2>/dev/null || true
ok "Linux system dependencies installed"
else
warn "No supported package manager (apt-get/dnf/yum). You may need to install system dependencies manually."
warn "Required packages: ${CAMOUFOX_LINUX_DEPS[*]}"
warn "No supported package manager. Install deps manually."
warn "Required: ${CAMOUFOX_LINUX_DEPS[*]}"
fi
}
install_camofox_browser() {
info "Installing camofox-browser (anti-detection browser)..."
# ─── Camoufox Browser Installer ──────────────────────────────────────────
install_camoufox_browser() {
info "Installing Camoufox browser (anti-detection engine)..."
# Step 1: Install Linux system dependencies (needed by Playwright/Camoufox)
install_linux_deps
# Step 2: Install the npm package
if command -v npx &>/dev/null || command -v npm &>/dev/null; then
info "Installing npm package..."
npm install -g camoufox-browser@0.1.0 2>&1 | tail -3
if ! command -v npx &>/dev/null && ! command -v npm &>/dev/null; then
warn "Node.js not found. Skipping Camoufox install."
warn "Install Node.js and re-run: npm install -g camoufox-browser@0.1.0"
return 0
fi
info "Downloading Camoufox browser binary (this may take a while, ~662MB)..."
info "Running: npx --yes camoufox-js@0.11.0 fetch"
npx --yes camoufox-js@0.11.0 fetch 2>&1
# Step 1: Install npm package
info "Installing npm package (camoufox-browser@0.1.0)..."
npm install -g camoufox-browser@0.1.0 2>&1 | tail -3 || {
warn "npm install failed. Try manually: npm install -g camoufox-browser@0.1.0"
return 0
}
# Verify the browser binary was actually downloaded
# macOS: ~/Library/Caches/camoufox/ | Linux: ~/.cache/camoufox/
local cache_dir
if [ "$(uname -s)" = "Darwin" ]; then
cache_dir="$HOME/Library/Caches/camoufox"
else
cache_dir="$HOME/.cache/camoufox"
# Step 2: Download browser binary
info "Downloading Camoufox browser binary (~311MB)..."
npx --yes camoufox-js@0.11.0 fetch 2>&1 || {
warn "Download failed. Try manually: npx --yes camoufox-js@0.11.0 fetch"
return 0
}
# Step 3: macOS — remove Gatekeeper quarantine
if [ "$(uname -s)" = "Darwin" ]; then
if command -v xattr &>/dev/null; then
info "Removing macOS quarantine from Camoufox..."
xattr -dr com.apple.quarantine ~/Library/Caches/camoufox 2>/dev/null || true
fi
fi
if [ -f "$cache_dir/camoufox" ]; then
ok "Camoufox browser binary downloaded ($cache_dir/)"
elif [ -f "$cache_dir/version.json" ]; then
ok "Camoufox browser cache found at $cache_dir/ (binary downloaded)"
else
warn "Browser binary not found at $cache_dir/. May need manual 'npx --yes camoufox-js@0.11.0 fetch'"
fi
ok "Camoufox browser npm package installed"
elif command -v docker &>/dev/null; then
info "Installing via Docker..."
docker run -d --name camoufox -p 9377:9377 \
-e CAMOUFOX_WS_PORT=9377 \
--restart unless-stopped \
ghcr.io/nousresearch/camoufox-browser:latest 2>&1 | tail -3
ok "Camoufox browser installed (Docker)"
# Step 4: Verify
local cache_dir
if [ "$(uname -s)" = "Darwin" ]; then
cache_dir="$HOME/Library/Caches/camoufox"
else
warn "Neither npm nor docker found. Install manually: npm install -g camoufox-browser@0.1.0"
cache_dir="$HOME/.cache/camoufox"
fi
if [ -f "$cache_dir/version.json" ]; then
ok "Camoufox browser installed ($(du -sh "$cache_dir" 2>/dev/null | cut -f1))"
else
warn "Browser binary not found. Run manually: npx --yes camoufox-js@0.11.0 fetch"
fi
}
build_release() {
# ─── Build GyanDoot ──────────────────────────────────────────────────────
build_gyandoot() {
local root_dir
root_dir="$(cd "$(dirname "$0")" && pwd)"
info "Building GyanDoot v2.0 in release mode..."
root_dir="$(cd "$(dirname "$0")" 2>/dev/null && pwd || echo "$PWD")"
# Find workspace root (where Cargo.toml with [workspace] is)
cd "$root_dir"
if [ ! -f "$root_dir/Cargo.toml" ]; then
local probe
probe="$(pwd)"
while [ "$probe" != "/" ]; do
if [ -f "$probe/Cargo.toml" ] && grep -q '\[workspace\]' "$probe/Cargo.toml" 2>/dev/null; then
root_dir="$probe"
cd "$root_dir"
info "Found workspace root at $root_dir"
break
fi
probe="$(dirname "$probe")"
done
while [ "$PWD" != "/" ]; do
if [ -f "Cargo.toml" ] && grep -q '\[workspace\]' Cargo.toml 2>/dev/null; then
info "Found workspace root at $PWD"
break
fi
cd ..
done
if [ "$PWD" = "/" ]; then
err "Could not find Cargo workspace. Make sure you're in the gyandoot-v2 directory."
fi
cargo build --release
ok "Build complete ($(du -sh target/release/gyandoot | cut -f1))"
info "Building GyanDoot v2.0 (release mode)..."
cargo build --release 2>&1 | tail -5
ok "Build complete ($(du -sh target/release/gyandoot* 2>/dev/null | cut -f1))"
}
# ─── Install Binary ──────────────────────────────────────────────────────
install_binary() {
local root_dir
root_dir="$(cd "$(dirname "$0")" && pwd)"
local target_dir="$root_dir/target/release"
local target_dir="$PWD/target/release"
local bin_name="gyandoot"
if [ -f "$target_dir/gyandoot.exe" ]; then
bin_name="gyandoot.exe"
fi
if [ ! -f "$target_dir/$bin_name" ]; then
err "Binary not found at $target_dir/$bin_name"
fi
# ── Detect best install location per platform ─────────────────────
# Priority:
# 1. ~/.cargo/bin/ — always in PATH for Rust users, no sudo
# 2. /usr/local/bin/ — standard Unix location, may need sudo
# 3. Windows: use a standard PATH location or just warn
#
local os
os="$(uname -s)"
local install_dir=""
local installed_to=""
# Detect WSL (Windows Subsystem for Linux)
local is_wsl=false
if [ -f /proc/version ] && grep -qiE 'microsoft|wsl' /proc/version 2>/dev/null; then
is_wsl=true
fi
case "$os" in
Darwin|Linux)
# Option A: ~/.cargo/bin/ (no sudo needed, always in PATH for Rust users)
# Priority: ~/.cargo/bin/ → /usr/local/bin → ~/.local/bin/
if [ -d "$HOME/.cargo/bin" ] && echo "$PATH" | grep -q "$HOME/.cargo/bin"; then
install_dir="$HOME/.cargo/bin"
cp "$target_dir/$bin_name" "$install_dir/$bin_name"
chmod +x "$install_dir/$bin_name"
installed_to="$install_dir/$bin_name"
# Option B: /usr/local/bin/ (standard, may need sudo)
elif [ -d "/usr/local/bin" ]; then
if [ -w "/usr/local/bin" ]; then
install_dir="/usr/local/bin"
cp "$target_dir/$bin_name" "$install_dir/$bin_name"
chmod +x "$install_dir/$bin_name"
else
info "Need sudo to install to /usr/local/bin"
sudo cp "$target_dir/$bin_name" "/usr/local/bin/$bin_name"
sudo chmod +x "/usr/local/bin/$bin_name"
install_dir="/usr/local/bin"
fi
installed_to="$install_dir/$bin_name"
# Option C: ~/.local/bin/ (XDG, common on modern Linux)
elif [ -d "$HOME/.local/bin" ] && echo "$PATH" | grep -q "$HOME/.local/bin"; then
install_dir="$HOME/.local/bin"
cp "$target_dir/$bin_name" "$install_dir/$bin_name"
chmod +x "$install_dir/$bin_name"
installed_to="$install_dir/$bin_name"
else
# Fallback: just copy to ~/.cargo/bin and create it
mkdir -p "$HOME/.cargo/bin"
cp "$target_dir/$bin_name" "$HOME/.cargo/bin/$bin_name"
chmod +x "$HOME/.cargo/bin/$bin_name"
install_dir="$HOME/.cargo/bin"
installed_to="$install_dir/$bin_name"
if ! echo "$PATH" | grep -q "$HOME/.cargo/bin"; then
warn "$HOME/.cargo/bin is not in your PATH."
warn "Add this to your shell profile (~/.zshrc, ~/.bashrc, etc.):"
warn "Add ~/.cargo/bin to your PATH in $(get_shell_profile):"
echo " export PATH=\"\$HOME/.cargo/bin:\$PATH\""
fi
fi
if [ -n "$install_dir" ]; then
cp "$target_dir/$bin_name" "$install_dir/$bin_name"
chmod +x "$install_dir/$bin_name"
installed_to="$install_dir/$bin_name"
fi
;;
CYGWIN*|MINGW*|MSYS*)
# Windows / Git Bash / MSYS2
install_dir="/usr/local/bin"
cp "$target_dir/$bin_name" "$install_dir/$bin_name"
chmod +x "$install_dir/$bin_name"
installed_to="$install_dir/$bin_name"
warn "Windows detected. Make sure '$install_dir' is in your PATH."
;;
*)
err "Unsupported OS: $os"
@@ -334,65 +346,49 @@ install_binary() {
ok "Installed to $installed_to"
# ── Verify it's usable via PATH ──────────────────────────────────
# ── Verify PATH resolution ──────────────────────────────────────────
local cmd_path
cmd_path="$(command -v gyandoot 2>/dev/null || true)"
if [ -z "$cmd_path" ]; then
warn "'gyandoot' not found in PATH after install."
warn "The install directory may not be in your PATH."
warn "Try running with: $installed_to"
if [ -n "$install_dir" ]; then
case "$os" in
Darwin)
echo ""
echo " Add to your ~/.zshrc:"
echo " export PATH=\"$install_dir:\$PATH\""
echo " Then: source ~/.zshrc"
;;
Linux)
echo ""
echo " Add to your ~/.bashrc:"
echo " export PATH=\"$install_dir:\$PATH\""
echo " Then: source ~/.bashrc"
;;
esac
fi
warn "'gyandoot' not found in PATH. Use: $installed_to"
elif [ "$cmd_path" != "$installed_to" ]; then
warn "There's ANOTHER 'gyandoot' at '$cmd_path' that takes priority over '$installed_to'."
warn "That binary is from a PREVIOUS installation and may be outdated."
warn ""
warn " ▶ To use the NEW version, run: $installed_to"
warn " ▶ Or remove the old one: sudo rm $cmd_path"
warn " ▶ Then 'gyandoot run' will pick up the new one."
warn "OLD binary at '$cmd_path' takes priority over '$installed_to'."
warn "Remove old: sudo rm $cmd_path || rm $cmd_path"
warn "Then 'gyandoot run' will use the new version."
else
ok "PATH resolves to the newly installed binary."
ok "'gyandoot' resolves to the newly installed binary."
fi
}
# ─── Post-Install Summary ────────────────────────────────────────────────
print_post_install() {
echo ""
ok "GyanDoot v2.0 installed successfully!"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Quick Start:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " gyandoot --help Show all commands"
echo " gyandoot init Create config"
echo " gyandoot setup Interactive setup wizard"
echo " gyandoot run Start interactive agent"
echo ""
echo " Browser Tools (anti-detection browsing):"
echo " gyandoot browser health Check camofox status"
echo " gyandoot browser search <query>"
echo " gyandoot browser browse <url>"
echo ""
echo " Service Management:"
echo " gyandoot service install Auto-start on boot"
echo " gyandoot service remove Remove system service"
echo " gyandoot service status Check service status"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "╔═══════════════════════════════════════════════════════════╗"
echo "║ Quick Start ║"
echo "╠═══════════════════════════════════════════════════════════╣"
echo "║ gyandoot --help Show all commands ║"
echo "║ gyandoot setup Interactive config wizard ║"
echo "║ gyandoot run Start interactive agent ║"
echo "╠═══════════════════════════════════════════════════════════╣"
echo "║ Browser Tools (anti-detection): ║"
echo "║ gyandoot browser health Check Camoufox status ║"
echo "║ gyandoot browser search Search the web ║"
echo "║ gyandoot browser browse Visit a website ║"
echo "╠═══════════════════════════════════════════════════════════╣"
echo "║ Service Management: ║"
echo "║ gyandoot service install Auto-start on boot ║"
echo "║ gyandoot service status Check service status ║"
echo "╚═══════════════════════════════════════════════════════════╝"
echo ""
if [ "$(uname -s)" = "Darwin" ]; then
echo " 🍎 macOS — Camoufox Gatekeeper (one-time):"
echo " xattr -dr com.apple.quarantine ~/Library/Caches/camoufox"
echo ""
fi
if detect_wsl; then
echo " ⚠️ WSL detected — Node.js must be installed INSIDE WSL."
echo " (The Windows-side Node.js is not accessible from WSL.)"
@@ -400,48 +396,65 @@ print_post_install() {
fi
}
# ─── Service Installation Prompt ─────────────────────────────────────────
prompt_service_install() {
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "────────────────────────────────────────────"
echo " Optional: Auto-start GyanDoot on Boot?"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "────────────────────────────────────────────"
echo " GyanDoot can run as a system service and"
echo " start automatically when your computer boots."
echo " This keeps the gateway server running in the background."
echo ""
echo " (You can also do this later with: gyandoot service install)"
echo " (You can also do this later: gyandoot service install)"
echo ""
read -r -p " Install system service? [y/N]: " response
case "$response" in
[yY]|[yY][eE][sS])
info "Installing GyanDoot system service..."
gyandoot service install 2>&1 || warn "Service install failed (run later: gyandoot service install)"
;;
*)
info "Skipping service install"
;;
esac
}
# ═══════════════════════════════════════════════════════════════════════════
# MAIN
# ═══════════════════════════════════════════════════════════════════════════
main() {
banner
local os arch
os=$(detect_os)
arch=$(detect_architecture)
info "Detected: $os / $arch"
if detect_wsl; then
info "WSL (Windows Subsystem for Linux) detected — will install Linux dependencies"
info "WSL (Windows Subsystem for Linux) detected"
fi
# ── Install dependencies ───────────────────────────────────────────
info "Phase 1: Checking prerequisites..."
install_rust_if_needed
install_node_if_needed
install_camofox_browser
build_release
# ── Install Camoufox browser ───────────────────────────────────────
info "Phase 2: Installing Camoufox browser..."
install_camoufox_browser
# ── Build from source ──────────────────────────────────────────────
info "Phase 3: Building GyanDoot..."
build_gyandoot
# ── Install binary ─────────────────────────────────────────────────
info "Phase 4: Installing binary..."
install_binary
# Optional: install GyanDoot system service (auto-start on boot)
# ── Optional: system service ───────────────────────────────────────
info "Phase 5: Service setup..."
prompt_service_install
case "$response" in
[yY]|[yY][eE][sS])
info "Installing GyanDoot system service..."
gyandoot service install 2>&1 || warn "Service install failed (run 'gyandoot service install' later)"
;;
*)
info "Skipping service install (use 'gyandoot service install' later)"
;;
esac
# ── Done ───────────────────────────────────────────────────────────
print_post_install
}