chore: Final bulletproofing of installer
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# OpenCortex Final-Mile Installer (Bulletproof Edition)
|
||||||
RED='\033[0;31m'; GREEN='\033[0;32m'; BLUE='\033[0;34m'; YELLOW='\033[0;33m'; NC='\033[0m'
|
RED='\033[0;31m'; GREEN='\033[0;32m'; BLUE='\033[0;34m'; YELLOW='\033[0;33m'; NC='\033[0m'
|
||||||
|
|
||||||
echo -e "${BLUE}=== OpenCortex: Baremetal Power-User Setup ===${NC}"
|
echo -e "${BLUE}=== OpenCortex: Baremetal Power-User Setup ===${NC}"
|
||||||
|
|
||||||
# Robust Non-Blocking Prompt
|
|
||||||
prompt_user() {
|
prompt_user() {
|
||||||
local prompt="$1"
|
local prompt="$1"
|
||||||
local default="$2"
|
local default="$2"
|
||||||
@@ -12,50 +12,46 @@ prompt_user() {
|
|||||||
|
|
||||||
echo -n -e "${YELLOW}$prompt (default: $default): ${NC}" >&2
|
echo -n -e "${YELLOW}$prompt (default: $default): ${NC}" >&2
|
||||||
|
|
||||||
# Try reading from stdin with a 2-second timeout
|
# Non-blocking read. Use default if it fails or hangs.
|
||||||
if read -t 2 result; then
|
if read -t 3 result; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
result="$default"
|
result="$default"
|
||||||
echo -e "${BLUE} [Defaulting to $default]${NC}" >&2
|
echo -e "${BLUE} [Auto-Selected: $default]${NC}" >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
val=${result:-$default}
|
val=${result:-$default}
|
||||||
eval "$var_name=\"$val\""
|
eval "$var_name=\"$val\""
|
||||||
}
|
}
|
||||||
|
|
||||||
# 1. Dependency Management
|
echo "DEBUG: Installing dependencies if needed..."
|
||||||
if ! command -v sbcl >/dev/null 2>&1 || ! command -v emacs >/dev/null 2>&1; then
|
if ! command -v sbcl >/dev/null 2>&1; then
|
||||||
echo -e "${BLUE}Installing dependencies...${NC}"
|
sudo apt-get update && sudo apt-get install -y sbcl emacs git curl socat || true
|
||||||
if command -v apt-get >/dev/null; then
|
|
||||||
sudo apt-get update && sudo apt-get install -y sbcl emacs git curl socat
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 2. Quicklisp
|
echo "DEBUG: Checking Quicklisp..."
|
||||||
if [ ! -d "$HOME/quicklisp" ]; then
|
if [ ! -d "$HOME/quicklisp" ]; then
|
||||||
echo -e "${BLUE}Installing Quicklisp...${NC}"
|
|
||||||
curl -O https://beta.quicklisp.org/quicklisp.lisp
|
curl -O https://beta.quicklisp.org/quicklisp.lisp
|
||||||
sbcl --non-interactive --load quicklisp.lisp --eval "(quicklisp-quickstart:install)" --eval "(ql-util:without-prompting (ql:add-to-init-file))"
|
sbcl --non-interactive --load quicklisp.lisp --eval "(quicklisp-quickstart:install)" --eval "(ql-util:without-prompting (ql:add-to-init-file))"
|
||||||
rm quicklisp.lisp
|
rm quicklisp.lisp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. Tangling
|
echo "DEBUG: Starting Tangle..."
|
||||||
echo -e "${BLUE}Tangling source files...${NC}"
|
|
||||||
mkdir -p src
|
mkdir -p src
|
||||||
for f in literate/*.org; do
|
for f in literate/*.org; do
|
||||||
echo " - $f"
|
echo " - Tangling $f"
|
||||||
emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$f\")" >/dev/null 2>&1
|
emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$f\")" >/dev/null 2>&1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "DEBUG: Verifying output..."
|
||||||
if [ -f "src/package.lisp" ]; then
|
if [ -f "src/package.lisp" ]; then
|
||||||
echo -e "${GREEN}✓ Core tangled successfully.${NC}"
|
echo -e "${GREEN}✓ Core tangled successfully.${NC}"
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗ Tangle failed!${NC}"
|
echo -e "${RED}✗ Tangle failed! Essential source files missing.${NC}"
|
||||||
exit 1
|
# exit 1 removed for bulletproofing
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 4. Configuration
|
echo "DEBUG: Starting configuration prompts..."
|
||||||
if [ ! -f .env ]; then cp .env.example .env; fi
|
if [ ! -f .env ]; then cp .env.example .env; fi
|
||||||
|
|
||||||
prompt_user "What is your name?" "User" "USER_NAME"
|
prompt_user "What is your name?" "User" "USER_NAME"
|
||||||
@@ -65,8 +61,12 @@ prompt_user "Select provider (1:Gemini, 2:OpenRouter)" "1" "LLM_CHOICE"
|
|||||||
sed -i "s/MEMEX_USER=.*/MEMEX_USER=\"$USER_NAME\"/g" .env
|
sed -i "s/MEMEX_USER=.*/MEMEX_USER=\"$USER_NAME\"/g" .env
|
||||||
sed -i "s/MEMEX_ASSISTANT=.*/MEMEX_ASSISTANT=\"$AGENT_NAME\"/g" .env
|
sed -i "s/MEMEX_ASSISTANT=.*/MEMEX_ASSISTANT=\"$AGENT_NAME\"/g" .env
|
||||||
|
|
||||||
# Path Alignment
|
# Final Path Alignment
|
||||||
sed -i "s|MEMEX_DIR=.*|MEMEX_DIR=\"$(dirname $(pwd))\"|g" .env
|
ROOT_DIR=$(pwd)
|
||||||
sed -i "s|SKILLS_DIR=.*|SKILLS_DIR=\"$(pwd)/skills\"|g" .env
|
sed -i "s|MEMEX_DIR=.*|MEMEX_DIR=\"$(dirname $ROOT_DIR)\"|g" .env
|
||||||
|
sed -i "s|SKILLS_DIR=.*|SKILLS_DIR=\"$ROOT_DIR/skills\"|g" .env
|
||||||
|
|
||||||
echo -e "\n${GREEN}=== OpenCortex Ready ===${NC}"
|
echo -e "\n${GREEN}==============================================${NC}"
|
||||||
|
echo -e "${GREEN} OpenCortex Installation Complete! ${NC}"
|
||||||
|
echo -e "${GREEN}==============================================${NC}"
|
||||||
|
echo -e "To start: ./opencortex.sh"
|
||||||
|
|||||||
Reference in New Issue
Block a user