Add bootstrap script for VPS agent setup - Automatically clones/updates homelab-agents repo
This commit is contained in:
57
scripts/bootstrap-agents.sh
Executable file
57
scripts/bootstrap-agents.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# Bootstrap script for VPS - Ensures latest homelab agents are available
|
||||
#
|
||||
# Usage: source ~/.homelab-setup.sh
|
||||
# Or add to ~/.bashrc for automatic setup on login
|
||||
#
|
||||
# This script:
|
||||
# - Clones or updates the homelab-agents repo
|
||||
# - Sets up git remotes for pushing VPS work
|
||||
# - Makes agents available for Claude Code
|
||||
|
||||
set -e
|
||||
|
||||
GITEA_URL="http://100.120.125.113:3000"
|
||||
AGENTS_REPO="$GITEA_URL/pdm/homelab-agents.git"
|
||||
AGENTS_DIR="$HOME/.homelab-agents"
|
||||
|
||||
echo "🔧 Bootstrapping homelab agents..."
|
||||
|
||||
# Create agents directory if needed
|
||||
if [[ ! -d "$AGENTS_DIR" ]]; then
|
||||
echo "📦 Cloning homelab-agents from Gitea..."
|
||||
git clone "$AGENTS_REPO" "$AGENTS_DIR"
|
||||
echo "✅ homelab-agents cloned to $AGENTS_DIR"
|
||||
else
|
||||
echo "📂 homelab-agents directory exists, updating..."
|
||||
cd "$AGENTS_DIR"
|
||||
|
||||
# Ensure git is initialized
|
||||
if [[ ! -d .git ]]; then
|
||||
git init
|
||||
git remote add origin "$AGENTS_REPO"
|
||||
fi
|
||||
|
||||
# Update remote URL in case it changed
|
||||
git remote set-url origin "$AGENTS_REPO" 2>/dev/null || git remote add origin "$AGENTS_REPO"
|
||||
|
||||
# Pull latest agents
|
||||
if git pull origin main 2>/dev/null; then
|
||||
echo "✅ homelab-agents updated to latest version"
|
||||
else
|
||||
echo "⚠️ Could not pull from main branch (might not exist yet)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Verify agents are available
|
||||
if [[ -f "$AGENTS_DIR/agents/sysadmin-session-closer.md" ]]; then
|
||||
echo "✅ sysadmin-session-closer agent available"
|
||||
echo ""
|
||||
echo "📋 Agent location: $AGENTS_DIR/agents/sysadmin-session-closer.md"
|
||||
echo "🚀 Use in Claude Code: Include the agent from this path"
|
||||
else
|
||||
echo "⚠️ Warning: sysadmin-session-closer.md not found"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✨ Homelab agents bootstrap complete!"
|
||||
Reference in New Issue
Block a user