#!/bin/sh
set -e

case "$1" in
    remove)
        # Restore pixmap diverseions
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/pixmaps/ubuntu-logo-text.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/pixmaps/ubuntu-logo-text-dark.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/pixmaps/ubuntu-logo-icon.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/pixmaps/ubuntu-logo-dark.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/pixmaps/ubuntu-logo.svg

        # Restore Humanity icons diversions (we need a better way to do this)
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Humanity/places/16/start-here.svg
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Humanity/places/22/start-here.svg
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Humanity/places/24/start-here.svg
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Humanity/places/48/start-here.svg
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Humanity/places/64/start-here.svg

        # Restore Ubiquity icon diversions
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/16x16/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/16x16@2x/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/22x22/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/22x22@2x/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/24x24/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/24x24@2x/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/256x256/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/256x256@2x/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/32x32/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/32x32@2x/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/48x48/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/48x48@2x/apps/ubiquity.png
        dpkg-divert --quiet --rename --package edubuntu-artwork --remove /usr/share/icons/Yaru/scalable/actions/view-app-grid-ubuntu-symbolic.svg

        # Update icon cache
        gtk-update-icon-cache

        # Force update the compiled glib schemas
        glib-compile-schemas /usr/share/glib-2.0/schemas || true

    ;;
esac

#DEBHELPER#
