[ADD] Debug files
This commit is contained in:
parent
7b742858db
commit
a323b1e9d0
130
diagnose_install.sh
Normal file
130
diagnose_install.sh
Normal file
@ -0,0 +1,130 @@
|
||||
#!/bin/bash
|
||||
# MCP Bridge Installation Diagnostic Script
|
||||
# Run this manually in HA terminal to see what's happening
|
||||
|
||||
echo "=== MCP Bridge Installation Diagnostic ==="
|
||||
echo ""
|
||||
|
||||
# 1. Check network connectivity
|
||||
echo "1. Testing Gitea connectivity..."
|
||||
GITEA_URL="${GITEA_URL:-https://www.git.quarantinedstudio.com}"
|
||||
REPO="${REPO:-mvezina/homeassistant-mcp-bridge}"
|
||||
|
||||
echo " Attempting to reach: $GITEA_URL/$REPO"
|
||||
if curl -I "$GITEA_URL/$REPO" 2>&1 | head -n 1; then
|
||||
echo " ✓ Can reach Gitea server"
|
||||
else
|
||||
echo " ✗ Cannot reach Gitea server"
|
||||
echo " Please check:"
|
||||
echo " - Is Gitea running?"
|
||||
echo " - Is the URL correct?"
|
||||
echo " - Can HA reach your Gitea server?"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 2. Check if curl exists
|
||||
echo "2. Checking for curl..."
|
||||
if command -v curl &> /dev/null; then
|
||||
echo " ✓ curl is available: $(which curl)"
|
||||
curl --version | head -n 1
|
||||
else
|
||||
echo " ✗ curl is NOT available"
|
||||
echo " Checking for wget..."
|
||||
if command -v wget &> /dev/null; then
|
||||
echo " ✓ wget is available: $(which wget)"
|
||||
else
|
||||
echo " ✗ Neither curl nor wget available!"
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 3. Check config directory
|
||||
echo "3. Checking config directory..."
|
||||
CONFIG_DIR="/config"
|
||||
if [ -d "$CONFIG_DIR" ]; then
|
||||
echo " ✓ /config exists"
|
||||
else
|
||||
echo " ✗ /config does not exist, trying alternate..."
|
||||
CONFIG_DIR="${HOME}/.homeassistant"
|
||||
if [ -d "$CONFIG_DIR" ]; then
|
||||
echo " ✓ Using $CONFIG_DIR"
|
||||
else
|
||||
echo " ✗ Cannot find config directory!"
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 4. Check/create custom_components directory
|
||||
echo "4. Checking custom_components directory..."
|
||||
CUSTOM_DIR="$CONFIG_DIR/custom_components"
|
||||
if [ -d "$CUSTOM_DIR" ]; then
|
||||
echo " ✓ $CUSTOM_DIR exists"
|
||||
else
|
||||
echo " ! $CUSTOM_DIR does not exist, creating..."
|
||||
mkdir -p "$CUSTOM_DIR" && echo " ✓ Created successfully" || echo " ✗ Failed to create"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 5. Check write permissions
|
||||
echo "5. Checking write permissions..."
|
||||
TEST_FILE="$CUSTOM_DIR/test_write_$$"
|
||||
if touch "$TEST_FILE" 2>/dev/null; then
|
||||
echo " ✓ Can write to $CUSTOM_DIR"
|
||||
rm "$TEST_FILE"
|
||||
else
|
||||
echo " ✗ Cannot write to $CUSTOM_DIR"
|
||||
echo " Permission issue!"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 6. Try downloading a test file
|
||||
echo "6. Testing file download..."
|
||||
BRANCH="${BRANCH:-main}"
|
||||
TEST_URL="$GITEA_URL/$REPO/raw/branch/$BRANCH/custom_components/mcp_bridge/manifest.json"
|
||||
echo " URL: $TEST_URL"
|
||||
|
||||
TEMP_FILE="/tmp/mcp_test_$$"
|
||||
if curl -fsSL "$TEST_URL" -o "$TEMP_FILE" 2>/dev/null; then
|
||||
echo " ✓ Successfully downloaded test file"
|
||||
echo " File size: $(wc -c < "$TEMP_FILE") bytes"
|
||||
echo " First line: $(head -n 1 "$TEMP_FILE")"
|
||||
rm "$TEMP_FILE"
|
||||
else
|
||||
echo " ✗ Failed to download test file"
|
||||
echo " Possible issues:"
|
||||
echo " - Wrong repository name or path"
|
||||
echo " - Wrong branch name"
|
||||
echo " - File doesn't exist at that path"
|
||||
echo " - Network/firewall blocking"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 7. Check existing installation
|
||||
echo "7. Checking for existing installation..."
|
||||
INSTALL_DIR="$CONFIG_DIR/custom_components/mcp_bridge"
|
||||
if [ -d "$INSTALL_DIR" ]; then
|
||||
echo " ✓ Installation directory exists: $INSTALL_DIR"
|
||||
echo " Files:"
|
||||
ls -lh "$INSTALL_DIR" 2>/dev/null || echo " (empty or cannot list)"
|
||||
|
||||
if [ -f "$INSTALL_DIR/manifest.json" ]; then
|
||||
VERSION=$(grep -oP '"version":\s*"\K[^"]+' "$INSTALL_DIR/manifest.json" 2>/dev/null || echo "unknown")
|
||||
echo " Current version: $VERSION"
|
||||
fi
|
||||
else
|
||||
echo " ! Installation directory does not exist yet"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# 8. Provide installation command
|
||||
echo "8. Suggested installation command:"
|
||||
echo ""
|
||||
echo " export GITEA_URL=\"$GITEA_URL\""
|
||||
echo " export REPO=\"$REPO\""
|
||||
echo " export BRANCH=\"$BRANCH\""
|
||||
echo " curl -fsSL \"\$GITEA_URL/\$REPO/raw/branch/\$BRANCH/quick_install.sh\" | bash"
|
||||
echo ""
|
||||
echo "=== Diagnostic Complete ==="
|
||||
echo ""
|
||||
echo "If all checks passed, run the installation command above."
|
||||
echo "If checks failed, fix the issues indicated and try again."
|
||||
@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
# MCP Bridge Quick Installer with Logging
|
||||
# Logs to /config/mcp_bridge_install.log
|
||||
|
||||
# Configuration
|
||||
GITEA_URL="${GITEA_URL:-http://your-gitea.local:3000}"
|
||||
REPO="${REPO:-username/homeassistant-mcp-bridge}"
|
||||
BRANCH="${BRANCH:-main}"
|
||||
BASE_URL="$GITEA_URL/$REPO/raw/branch/$BRANCH/custom_components/mcp_bridge"
|
||||
|
||||
# Logging
|
||||
LOG_FILE="/config/mcp_bridge_install.log"
|
||||
exec 1> >(tee -a "$LOG_FILE")
|
||||
exec 2>&1
|
||||
|
||||
echo "=== MCP Bridge Installation Started at $(date) ==="
|
||||
echo "Configuration:"
|
||||
echo " GITEA_URL: $GITEA_URL"
|
||||
echo " REPO: $REPO"
|
||||
echo " BRANCH: $BRANCH"
|
||||
echo " BASE_URL: $BASE_URL"
|
||||
echo ""
|
||||
|
||||
# Determine config directory
|
||||
CONFIG_DIR="${CONFIG_DIR:-/config}"
|
||||
if [ ! -d "$CONFIG_DIR" ]; then
|
||||
CONFIG_DIR="${HOME}/.homeassistant"
|
||||
echo "Using alternate config dir: $CONFIG_DIR"
|
||||
fi
|
||||
|
||||
DEST="$CONFIG_DIR/custom_components/mcp_bridge"
|
||||
echo "Installation directory: $DEST"
|
||||
echo ""
|
||||
|
||||
# Create directory
|
||||
echo "Creating directory..."
|
||||
mkdir -p "$DEST" || {
|
||||
echo "ERROR: Failed to create directory $DEST"
|
||||
exit 1
|
||||
}
|
||||
echo "Directory created: $DEST"
|
||||
echo ""
|
||||
|
||||
# Download files
|
||||
echo "Downloading files..."
|
||||
cd "$DEST" || exit 1
|
||||
|
||||
for file in __init__.py manifest.json services.yaml; do
|
||||
echo " Downloading $file from $BASE_URL/$file"
|
||||
|
||||
if curl -fsSL "$BASE_URL/$file" -o "$file"; then
|
||||
echo " ✓ $file downloaded successfully ($(wc -c < "$file") bytes)"
|
||||
else
|
||||
echo " ✗ FAILED to download $file"
|
||||
echo " URL attempted: $BASE_URL/$file"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=== Installation Summary ==="
|
||||
echo "Files installed in: $DEST"
|
||||
ls -lh "$DEST"
|
||||
echo ""
|
||||
echo "✅ MCP Bridge installed successfully!"
|
||||
echo "⚠️ IMPORTANT: Restart Home Assistant to activate"
|
||||
echo ""
|
||||
echo "Installation completed at $(date)"
|
||||
echo "=== End of Installation Log ==="
|
||||
Loading…
x
Reference in New Issue
Block a user