ComposeSync/test-install.sh

73 lines
No EOL
1.8 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=$(systemctl show composesync --property=ExecStart | sed 's/.*ExecStart=//' | sed 's|/update-agent.sh.*||')
if [ -z "$INSTALL_DIR" ]; then
echo "❌ Could not determine installation directory from service"
exit 1
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"