mygramps/uninstall_from_snap.sh
Daniel Viegas ce75cd55bb Convert plugin to Event-based view and improve filter dialog
- Convert plugin from Family-based to Event-based view
  * Change category from Families to Events
  * Update navigation_type to 'Event'
  * Replace FamilyBookmarks with EventBookmarks
  * Rewrite collect_events() to show all events in database
  * Update goto_handle() to work with event handles

- Update filter dialog to show families with members
  * Restructure person filter page with expandable families
  * Each family shows father, mother, and children
  * Add helper method to generate family display names

- Restore person connection lines
  * Re-enable visual connections between events of selected person
  * Clicking an event selects the person and shows connections

- Add uninstall script
  * Remove plugin files and backup directories
  * Clean up any plugin files in subdirectories
2025-11-29 21:42:10 +01:00

155 lines
4.4 KiB
Bash
Executable File

#!/bin/bash
#
# Script to uninstall MyTimeline plugin from snap-installed Gramps
#
# This script removes the MyTimeline plugin files from the Gramps snap plugin directory
#
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Plugin files to remove
PLUGIN_FILES=("MyTimeline.gpr.py" "MyTimeline.py")
# Target directory for snap-installed Gramps
PLUGIN_DEST_DIR="$HOME/snap/gramps/current/.local/share/gramps/gramps60/plugins"
# Alternative locations to try
ALTERNATIVE_DIRS=(
"$HOME/snap/gramps/current/.local/share/gramps/gramps60/plugins"
"$HOME/snap/gramps/current/.gramps/gramps60/plugins"
"$HOME/snap/gramps/current/.gramps/plugins"
"$HOME/snap/gramps/common/.local/share/gramps/gramps60/plugins"
"$HOME/.local/share/gramps/gramps60/plugins"
"$HOME/.gramps/gramps60/plugins"
)
echo "=========================================="
echo "MyTimeline Plugin Uninstaller for Snap Gramps"
echo "=========================================="
echo ""
# Function to find the correct plugin directory
find_plugin_dir() {
# Try the primary location first
if [ -d "$PLUGIN_DEST_DIR" ]; then
echo "$PLUGIN_DEST_DIR"
return 0
fi
# Try alternative locations
for dir in "${ALTERNATIVE_DIRS[@]}"; do
if [ -d "$dir" ]; then
echo "$dir"
return 0
fi
done
return 1
}
# Find the target directory
echo "Locating Gramps plugin directory..."
TARGET_DIR=$(find_plugin_dir)
if [ -z "$TARGET_DIR" ]; then
echo -e "${YELLOW}Warning: Plugin directory not found.${NC}"
echo "The plugin may already be uninstalled or Gramps may not be installed via snap."
exit 0
fi
echo -e "${GREEN}${NC} Target directory: $TARGET_DIR"
echo ""
# Check if plugin files exist
FILES_FOUND=0
FILES_REMOVED=0
for file in "${PLUGIN_FILES[@]}"; do
if [ -f "$TARGET_DIR/$file" ]; then
FILES_FOUND=$((FILES_FOUND + 1))
fi
done
if [ $FILES_FOUND -eq 0 ]; then
echo -e "${YELLOW}No plugin files found. The plugin may already be uninstalled.${NC}"
exit 0
fi
echo "Found $FILES_FOUND plugin file(s)."
echo ""
# Remove plugin files
echo "Removing plugin files..."
for file in "${PLUGIN_FILES[@]}"; do
if [ -f "$TARGET_DIR/$file" ]; then
rm "$TARGET_DIR/$file"
echo -e "${GREEN}${NC} Removed: $file"
FILES_REMOVED=$((FILES_REMOVED + 1))
fi
done
# Remove backup directories created by the installer
BACKUP_DIRS_REMOVED=0
echo ""
echo "Searching for backup directories..."
for backup_dir in "$TARGET_DIR"/mytimeline_backup_*; do
if [ -d "$backup_dir" ]; then
echo "Found backup directory: $(basename "$backup_dir")"
rm -rf "$backup_dir"
echo -e "${GREEN}${NC} Removed backup directory: $(basename "$backup_dir")"
BACKUP_DIRS_REMOVED=$((BACKUP_DIRS_REMOVED + 1))
fi
done
# Also check for any plugin files in subdirectories that might be loaded
echo ""
echo "Checking for plugin files in subdirectories..."
SUBDIR_FILES_REMOVED=0
for subdir in "$TARGET_DIR"/*; do
if [ -d "$subdir" ]; then
for file in "${PLUGIN_FILES[@]}"; do
if [ -f "$subdir/$file" ]; then
echo -e "${YELLOW}Warning: Found $file in subdirectory: $(basename "$subdir")${NC}"
rm -f "$subdir/$file"
echo -e "${GREEN}${NC} Removed: $(basename "$subdir")/$file"
SUBDIR_FILES_REMOVED=$((SUBDIR_FILES_REMOVED + 1))
fi
done
fi
done
TOTAL_REMOVED=$((FILES_REMOVED + BACKUP_DIRS_REMOVED + SUBDIR_FILES_REMOVED))
echo ""
echo "=========================================="
if [ $TOTAL_REMOVED -gt 0 ]; then
echo -e "${GREEN}Uninstallation completed successfully!${NC}"
echo "=========================================="
echo ""
echo "Removed:"
echo " - $FILES_REMOVED plugin file(s) from main directory"
if [ $BACKUP_DIRS_REMOVED -gt 0 ]; then
echo " - $BACKUP_DIRS_REMOVED backup directory/directories"
fi
if [ $SUBDIR_FILES_REMOVED -gt 0 ]; then
echo " - $SUBDIR_FILES_REMOVED plugin file(s) from subdirectories"
fi
echo ""
echo "Location: $TARGET_DIR"
echo ""
echo "Next steps:"
echo " 1. Restart Gramps if it's currently running"
echo " 2. The plugin should no longer appear in the Plugins menu"
else
echo -e "${YELLOW}No files or directories were removed.${NC}"
echo "=========================================="
fi
echo ""