#!/bin/bash # Fix Rust Installation and Build Backend echo "============================================" echo "Fixing Rust Installation" echo "============================================" echo "" # Add Cargo to PATH permanently echo "Adding Rust to your shell configuration..." if [ -f "$HOME/.zshrc" ]; then if ! grep -q '.cargo/env' "$HOME/.zshrc"; then echo '' >> "$HOME/.zshrc" echo '# Rust (Cargo)' >> "$HOME/.zshrc" echo 'source "$HOME/.cargo/env"' >> "$HOME/.zshrc" echo "✅ Added Rust to ~/.zshrc" else echo "✅ Rust already in ~/.zshrc" fi fi # Source it for current shell export PATH="$HOME/.cargo/bin:$PATH" # Check if rustup exists, if not install Rust if ! command -v rustup &> /dev/null; then echo "" echo "Installing Rust..." curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable source "$HOME/.cargo/env" fi # Set default toolchain rustup default stable echo "" echo "✅ Rust Configuration Complete" echo "" echo "Rust version: $(rustc --version)" echo "Cargo version: $(cargo --version)" echo "" # Now build the backend echo "============================================" echo "Building Backend" echo "============================================" echo "" cd core echo "Building... (this takes 5-10 minutes on first build)" cargo build --bin archipelago if [ $? -eq 0 ]; then echo "" echo "============================================" echo "✅ SUCCESS! Backend Built" echo "============================================" echo "" echo "Next steps:" echo "" echo "1. Restart your terminal (or run: source ~/.zshrc)" echo "" echo "2. Start the full stack:" echo " ./scripts/dev-start.sh" echo " Choose option 2" echo "" echo "Or manually:" echo " Terminal 1: cd core && cargo run --bin archipelago" echo " Terminal 2: cd neode-ui && npm run dev" echo "" else echo "" echo "❌ Build failed. Check errors above." fi