#!/bin/bash # Uninstallation script for NotePad set -e APP_NAME="NotePad" INSTALL_DIR="/opt/notepad" BIN_LINK="/usr/local/bin/notepad" DESKTOP_FILE="/usr/share/applications/notepad.desktop" echo "============================================================" echo "$APP_NAME Uninstaller" echo "============================================================" echo "" # Check if running as root if [ "$EUID" -ne 0 ]; then echo "❌ This script must be run as root (use sudo)" exit 1 fi echo "Uninstalling $APP_NAME..." echo "" # Remove symlink if [ -L "$BIN_LINK" ]; then echo "→ Removing symlink: $BIN_LINK" rm -f "$BIN_LINK" fi # Remove desktop entry if [ -f "$DESKTOP_FILE" ]; then echo "→ Removing desktop entry: $DESKTOP_FILE" rm -f "$DESKTOP_FILE" fi # Update desktop database if available if command -v update-desktop-database &> /dev/null; then echo "→ Updating desktop database..." update-desktop-database /usr/share/applications fi # Remove installation directory if [ -d "$INSTALL_DIR" ]; then echo "→ Removing installation directory: $INSTALL_DIR" rm -rf "$INSTALL_DIR" fi echo "" echo "============================================================" echo "✅ Uninstallation complete!" echo "============================================================" echo ""