From d49801136abb9f05c76c5a000453847186744ba9 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 23 Nov 2025 21:45:37 +0000 Subject: [PATCH] Fix: Bootstrap script now adds scripts directory to PATH permanently - Automatically adds 'export PATH="$HOME/.homelab-scripts:$PATH"' to ~/.bashrc - Checks if already present to avoid duplicates - Also adds to current session PATH immediately - Eliminates need for manual 'export PATH' commands - init-project now works in all future shells --- scripts/bootstrap-agents.sh | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/scripts/bootstrap-agents.sh b/scripts/bootstrap-agents.sh index be75102..7a5ed43 100755 --- a/scripts/bootstrap-agents.sh +++ b/scripts/bootstrap-agents.sh @@ -1,14 +1,14 @@ #!/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 +# Usage: bash <(curl -s http://100.120.125.113:3000/pdm/homelab-agents/raw/branch/main/scripts/bootstrap-agents.sh) # # This script: # - Clones or updates the homelab-agents repo # - Sets up git remotes for pushing VPS work # - Makes agents available for Claude Code # - Installs helper scripts (init-project) +# - Adds scripts to PATH permanently set -e @@ -53,15 +53,32 @@ mkdir -p "$SCRIPTS_DIR" if [[ -f "$AGENTS_DIR/scripts/init-project.sh" ]]; then cp "$AGENTS_DIR/scripts/init-project.sh" "$SCRIPTS_DIR/init-project" chmod +x "$SCRIPTS_DIR/init-project" - echo "✅ init-project installed" + echo "✅ init-project installed to $SCRIPTS_DIR" fi -# Add scripts directory to PATH if not already there -if [[ ":$PATH:" != *":$SCRIPTS_DIR:"* ]]; then - export PATH="$SCRIPTS_DIR:$PATH" - echo "✅ Scripts directory added to PATH" +# Add scripts directory to PATH permanently (in ~/.bashrc) +BASHRC="$HOME/.bashrc" +PATH_EXPORT="export PATH=\"\$HOME/.homelab-scripts:\$PATH\"" + +if [[ -f "$BASHRC" ]]; then + if ! grep -q "homelab-scripts" "$BASHRC"; then + echo "" >> "$BASHRC" + echo "# Homelab scripts directory" >> "$BASHRC" + echo "$PATH_EXPORT" >> "$BASHRC" + echo "✅ Added scripts directory to ~/.bashrc" + else + echo "✅ Scripts directory already in ~/.bashrc" + fi +else + # Create ~/.bashrc if it doesn't exist + echo "$PATH_EXPORT" > "$BASHRC" + echo "✅ Created ~/.bashrc with scripts directory" fi +# Also add to current session PATH +export PATH="$SCRIPTS_DIR:$PATH" +echo "✅ Scripts directory added to current session PATH" + # Verify agents are available if [[ -f "$AGENTS_DIR/agents/sysadmin-session-closer.md" ]]; then echo "✅ sysadmin-session-closer agent available" @@ -76,4 +93,6 @@ echo "📚 Available commands:" echo " init-project - Initialize a new project with git remote" echo " cd ~/.homelab-agents - Browse agents and scripts" echo "" -echo "📋 Agent location: $AGENTS_DIR/agents/sysadmin-session-closer.md" \ No newline at end of file +echo "📋 Agent location: $AGENTS_DIR/agents/sysadmin-session-closer.md" +echo "" +echo "💡 Tip: Run 'source ~/.bashrc' or restart your shell to ensure PATH is updated" \ No newline at end of file