#!/bin/sh set -e echo "[+] Setting up Zero-OS components..." # Check if we're in git repository if [ ! -d ".git" ]; then echo "Error: Not in a git repository. Please run 'git init' first." exit 1 fi # Create components directory mkdir -p components # 1. Zinit - master branch echo " Adding zinit (init system) from master branch..." if [ ! -d "components/zinit" ]; then git submodule add https://github.com/threefoldtech/zinit.git components/zinit cd components/zinit git checkout master cd ../.. else echo " zinit submodule already exists" fi # 2. RFS - tag v2.0.6 (musl build) echo " Adding rfs (rust filesystem) tag v2.0.6..." if [ ! -d "components/rfs" ]; then git submodule add https://github.com/threefoldtech/rfs.git components/rfs cd components/rfs git checkout v2.0.6 cd ../.. else echo " rfs submodule already exists" fi # 3. Mycelium - tag v0.6.1 (musl build) echo " Adding mycelium (networking layer) tag v0.6.1..." if [ ! -d "components/mycelium" ]; then git submodule add https://github.com/threefoldtech/mycelium.git components/mycelium cd components/mycelium git checkout v0.6.1 cd ../.. else echo " mycelium submodule already exists" fi # 4. CoreX - direct download (static binary) echo " Downloading CoreX static binary v2.1.4..." mkdir -p components/corex if [ ! -f "components/corex/corex" ]; then curl -L -o components/corex/corex https://github.com/threefoldtech/corex/releases/download/2.1.4/corex-2.1.4-amd64-linux-static chmod +x components/corex/corex echo " CoreX binary downloaded successfully" else echo " CoreX binary already exists" fi # Initialize and update submodules echo " Initializing submodules..." git submodule init git submodule update echo "[+] Zero-OS components setup complete" echo "" echo "Components added:" echo " - zinit (master): $(ls -la components/zinit 2>/dev/null | wc -l) files" echo " - rfs (v2.0.6): $(ls -la components/rfs 2>/dev/null | wc -l) files" echo " - mycelium (v0.6.1): $(ls -la components/mycelium 2>/dev/null | wc -l) files" echo " - corex (v2.1.4): $(ls -la components/corex/corex 2>/dev/null && echo "downloaded" || echo "missing")" echo "" echo "To update submodules later, run:" echo " git submodule update --remote"