Fix install script for same-directory installation and improve test script robustness

This commit is contained in:
robojerk 2025-06-25 15:22:05 -07:00
parent 70486907aa
commit 738c765d84
2 changed files with 38 additions and 11 deletions

View file

@ -6,11 +6,22 @@
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.*||')
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
echo "❌ Could not determine installation directory from service"
exit 1
# 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"