ComposeSync/test-install.sh

84 lines
No EOL
2.3 KiB
Bash

#!/bin/bash
# ComposeSync Installation Test Script
# Run this after installation to verify everything works
set -e
# Get the installation directory from the service file
INSTALL_DIR=""
if systemctl list-unit-files | grep -q composesync; then
INSTALL_DIR=$(systemctl show composesync --property=ExecStart 2>/dev/null | sed 's/.*ExecStart=//' | sed 's|/update-agent.sh.*||' || echo "")
fi
# If we can't get it from the service, try to determine from current directory
if [ -z "$INSTALL_DIR" ]; then
# Check if we're in a ComposeSync installation directory
if [ -f "update-agent.sh" ] && [ -f "config-parser.sh" ]; then
INSTALL_DIR="$(pwd)"
echo "⚠️ Service not found, testing current directory: $INSTALL_DIR"
else
echo "❌ Could not determine installation directory from service or current location"
echo " Make sure you're running this from the ComposeSync installation directory"
exit 1
fi
fi
echo "🧪 Testing ComposeSync installation in: $INSTALL_DIR"
# Check if service exists
if ! systemctl list-unit-files | grep -q composesync; then
echo "❌ ComposeSync service not found"
exit 1
fi
# Check if service is enabled
if systemctl is-enabled --quiet composesync; then
echo "✅ Service is enabled"
else
echo "❌ Service is not enabled"
fi
# Check if service is running
if systemctl is-active --quiet composesync; then
echo "✅ Service is running"
else
echo "❌ Service is not running"
fi
# Check if files exist
if [ -f "$INSTALL_DIR/update-agent.sh" ]; then
echo "✅ update-agent.sh exists"
else
echo "❌ update-agent.sh missing"
fi
if [ -f "$INSTALL_DIR/config-parser.sh" ]; then
echo "✅ config-parser.sh exists"
else
echo "❌ config-parser.sh missing"
fi
if [ -f "$INSTALL_DIR/.env" ]; then
echo "✅ .env file exists"
else
echo "❌ .env file missing"
fi
# Check permissions
if [ -x "$INSTALL_DIR/update-agent.sh" ]; then
echo "✅ update-agent.sh is executable"
else
echo "❌ update-agent.sh is not executable"
fi
# Check recent logs
echo ""
echo "📋 Recent service logs:"
journalctl -u composesync --no-pager -n 10
echo ""
echo "🎉 Installation test complete!"
echo ""
echo "If you see any ❌ errors above, please check the troubleshooting guide:"
echo " https://github.com/your-repo/ComposeSync/blob/main/Docs/troubleshooting.md"