Files

45 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
FRAMEWORK_DIR="$HOME/.automaton"
if [ ! -d "$FRAMEWORK_DIR" ]; then
echo "ERROR: automaton not installed at $FRAMEWORK_DIR"
echo "Run './install.sh' first."
exit 1
fi
echo "Updating automaton at $FRAMEWORK_DIR..."
cd "$FRAMEWORK_DIR"
# Check if it's a git repo
if [ ! -d ".git" ]; then
echo "ERROR: $FRAMEWORK_DIR is not a git repository."
echo "Cannot update. Please reinstall from git."
exit 1
fi
# Fetch latest changes
git fetch origin
echo ""
# Check for local changes
if ! git diff --quiet HEAD; then
echo "WARNING: You have uncommitted changes in $FRAMEWORK_DIR."
echo "These will be lost when pulling updates."
read -p "Do you want to discard your local changes and update? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Update cancelled."
exit 1
fi
git reset --hard HEAD
fi
# Pull latest changes
git pull origin main
echo ""
echo "Update complete."
echo "You can check for breaking changes at: https://gitea.yourdomain.com/hermes/automaton"