#!/bin/sh
set -e

case "$1" in
    install|upgrade)
        cleanup_and_divert() {
            # For quite a while we had broken diverts, try and fix them
            if [ -f $1.orig ]; then
                mv $1.orig $1
            fi
            dpkg-divert --quiet --package edubuntu-artwork --divert $1.orig --rename $1
        }
        # Pixmap Logos (for gnome-control-center)
        cleanup_and_divert /usr/share/pixmaps/ubuntu-logo-text.png
        cleanup_and_divert /usr/share/pixmaps/ubuntu-logo-icon.png
        cleanup_and_divert /usr/share/pixmaps/ubuntu-logo-dark.png
        cleanup_and_divert /usr/share/pixmaps/ubuntu-logo-text-dark.png
        cleanup_and_divert /usr/share/pixmaps/ubuntu-logo.svg

        # Humanity icon theme
        cleanup_and_divert /usr/share/icons/Humanity/places/16/start-here.svg
        cleanup_and_divert /usr/share/icons/Humanity/places/22/start-here.svg
        cleanup_and_divert /usr/share/icons/Humanity/places/24/start-here.svg
        cleanup_and_divert /usr/share/icons/Humanity/places/48/start-here.svg
        cleanup_and_divert /usr/share/icons/Humanity/places/64/start-here.svg

        # Ubiquity Icon
        cleanup_and_divert /usr/share/icons/Yaru/16x16/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/16x16@2x/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/22x22/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/22x22@2x/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/24x24/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/24x24@2x/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/256x256/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/256x256@2x/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/32x32/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/32x32@2x/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/48x48/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/48x48@2x/apps/ubiquity.png
        cleanup_and_divert /usr/share/icons/Yaru/scalable/actions/view-app-grid-ubuntu-symbolic.svg

    ;;
esac

#DEBHELPER#
