Files
home/scripts/install.sh
2025-08-27 15:35:28 +02:00

99 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# Hero Code Workspace Installer
# This script installs all repositories in the Hero Code ecosystem
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Repository list - each repo should have scripts/install.sh
REPOS=(
# "https://git.ourworld.tf/herocode/baobab"
# "https://git.ourworld.tf/herocode/leaf"
"https://git.ourworld.tf/herocode/herolib_rust"
# "https://git.ourworld.tf/herocode/herolib_v"
# "https://git.ourworld.tf/herocode/herolib_py"
# "https://git.ourworld.tf/herocode/actor_system"
# "https://git.ourworld.tf/herocode/actor_osis"
# "https://git.ourworld.tf/herocode/actor_v"
# "https://git.ourworld.tf/herocode/actor_python"
)
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "This script curls and executes install scripts from all Hero Code repositories."
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo ""
echo "Environment variables:"
echo " CODEROOT Override code directory (default: ~/code)"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
echo -e "${BLUE}===============================================${NC}"
echo -e "${BLUE} Hero Code Workspace Installer${NC}"
echo -e "${BLUE}===============================================${NC}"
echo ""
# Check system requirements
echo -e "${YELLOW}🔍 Checking system requirements...${NC}"
if ! command -v curl >/dev/null 2>&1; then
echo -e "${RED}❌ Error: curl is required but not installed${NC}"
exit 1
fi
echo -e "${GREEN}✅ curl found${NC}"
echo ""
# Install repositories by curling their install scripts
echo -e "${YELLOW}🔧 Installing Hero Code repositories...${NC}"
echo ""
failed_repos=()
for repo_url in "${REPOS[@]}"; do
repo_name=$(basename "$repo_url")
install_script_url="$repo_url/raw/branch/development/scripts/install.sh"
echo -e "${CYAN}📦 Installing $repo_name${NC}"
echo -e "${BLUE} Script: $install_script_url${NC}"
# Curl and execute the install script
if curl -sSL "$install_script_url" | bash; then
echo -e "${GREEN}$repo_name installed successfully${NC}"
else
echo -e "${RED}$repo_name installation failed${NC}"
failed_repos+=("$repo_name")
fi
echo ""
done
if [ ${#failed_repos[@]} -gt 0 ]; then
echo -e "${RED}❌ Failed to install: ${failed_repos[*]}${NC}"
exit 1
fi
echo -e "${GREEN}===============================================${NC}"
echo -e "${GREEN} Installation Complete!${NC}"
echo -e "${GREEN}===============================================${NC}"
echo ""
echo -e "${GREEN}🎉 All Hero Code repositories have been installed!${NC}"
echo ""