#!/bin/sh
set -e

if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
    # OBS-Repo und GPG-Key entfernen
    rm -f /etc/apt/sources.list.d/myapps-obs.list
    rm -f /etc/apt/trusted.gpg.d/myapps-obs.gpg

    # Icon + Desktop aufräumen
    rm -f /usr/share/icons/hicolor/scalable/apps/io.github.nicolettas-muggelbude.myapps.svg
    if command -v gtk-update-icon-cache >/dev/null 2>&1; then
        gtk-update-icon-cache -f -t /usr/share/icons/hicolor 2>/dev/null || true
    fi
    if command -v update-desktop-database >/dev/null 2>&1; then
        update-desktop-database -q /usr/share/applications 2>/dev/null || true
    fi
fi
