diff --git a/scripts/onboard-baremetal.sh b/scripts/onboard-baremetal.sh index 695a85b..7936173 100755 --- a/scripts/onboard-baremetal.sh +++ b/scripts/onboard-baremetal.sh @@ -1,5 +1,5 @@ #!/bin/bash -# set -e removed to allow graceful fallbacks +# OpenCortex Final-Mile Installer 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}" @@ -13,13 +13,12 @@ prompt_user() { echo -n -e "${YELLOW}$prompt (default: $default): ${NC}" >&2 - # Try reading from stdin with a 1-second timeout. - # If it fails or times out, we use the default. - if read -t 2 result; then + # Try reading with a short timeout. Use defaults if piped/no-tty. + if read -t 5 result; then : else result="$default" - echo -e "${BLUE}[Auto-Pilot: Using $default]${NC}" >&2 + echo -e "${BLUE} [Auto-Selected: $default]${NC}" >&2 fi val=${result:-$default} @@ -34,7 +33,7 @@ install_deps() { elif command -v pacman >/dev/null; then sudo pacman -S --noconfirm sbcl emacs git curl socat else - echo -e "${RED}✗ Unknown package manager. Please install SBCL/Emacs manually.${NC}" + echo -e "${RED}✗ Unknown package manager. Please install dependencies manually.${NC}" fi } @@ -60,18 +59,22 @@ if [ ! -d "$HOME/quicklisp" ] && [ ! -d "$HOME/.quicklisp" ]; then fi fi -# 3. Literate Tangling +# 3. Literate Tangling (The Transparent Version) echo -e "${BLUE}Tangling Literate Org files into source code...${NC}" -# Redirect emacs output to /dev/null to keep the console clean for the user -emacs --batch --eval "(require 'org)" --eval "(mapc 'org-babel-tangle-file (file-expand-wildcards \"literate/*.org\"))" >/dev/null 2>&1 || true +mkdir -p src +for f in literate/*.org; do + echo -e " - Tangling $f..." + emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$f\")" >/dev/null 2>&1 || echo -e "${RED} ! Warning: Tangle issue in $f${NC}" +done if [ ! -f "src/package.lisp" ]; then - echo -e "${RED}✗ Tangling failed. Manual intervention required.${NC}" + echo -e "${RED}✗ Tangling failed. Essential files missing in src/.${NC}" exit 1 fi -echo -e "${GREEN}✓ Core tangled.${NC}" +echo -e "${GREEN}✓ Core tangled successfully.${NC}" # 4. Environment Configuration +echo -e "\n${BLUE}Configuring your environment...${NC}" if [ ! -f .env ]; then cp .env.example .env; fi prompt_user "What is your name?" "User" "USER_NAME" @@ -101,7 +104,9 @@ mkdir -p "$PARENT_DIR/notes" echo -e "${GREEN}✓ Configuration complete.${NC}" # 6. Final Instructions -echo -e "\n${BLUE}=== Setup Complete ===${NC}" -echo -e "Your OpenCortex instance is ready." -echo -e "To start the brain: ${YELLOW}./opencortex.sh${NC}" -echo -e "To configure later, edit: ${YELLOW}$(pwd)/.env${NC}" +echo -e "\n${GREEN}==============================================${NC}" +echo -e "${GREEN} OpenCortex Installation Complete! ${NC}" +echo -e "${GREEN}==============================================${NC}" +echo -e "Your brain is ready to boot." +echo -e "\nTo start the session: ${YELLOW}./opencortex.sh${NC}" +echo -e "To add API keys later, edit: ${YELLOW}$(pwd)/.env${NC}\n"