1. Ronoaldo Pereira
  2. desktop-theme-growing

Source

desktop-theme-growing / debian / postrm

#!/bin/sh
# postrm script for desktop-theme-growing
#
# see: dh_installdeb(1)

set -e

# Restores the Plymouth theme to the previous one
restore_plymouth_theme() {
    sed -i  '/growing/d' /var/log/desktop-theme-packages.log
    # Get previous theme
    find /usr/share -maxdepth 1 -name "desktop-theme-*" > /dev/null && \
    plymouth_theme=$(tail -1 /var/log/desktop-theme-packages.log)
    # If there is no more desktop-theme package installed, remove the logfile
    find /usr/share -maxdepth 1 -name "desktop-theme-*" > /dev/null || rm -f /var/log/desktop-theme-packages.log
    # Set plymouth to previous theme
    if which plymouth-set-default-theme > /dev/null ; then
        find /usr/share -maxdepth 1 -name "desktop-theme-*" > /dev/null && plymouth-set-default-theme $plymouth_theme
        find /usr/share -maxdepth 1 -name "desktop-theme-*" > /dev/null  || plymouth-set-default-theme joy
        test -d /usr/share/images/desktop-base || plymouth-set-default-theme -r 
    fi
}

case "$1" in
    remove|deconfigure)
        if which update-grub2 > /dev/null ; then
            update-grub2 || true
        fi

        restore_plymouth_theme

        if [ -x /usr/sbin/update-initramfs ]; then
           update-initramfs -u || true
        fi

        # Reset gdm3 wallpaper cache
        rm -f /var/lib/gdm3/.cache/wallpaper/*
        if [ -x /usr/sbin/gdm3 ]; then
            invoke-rc.d gdm3 reload || true
        fi
        
        # Reload KDM so it wont complain about missing themes
        if [ -f /run/kdm.pid ]; then
            invoke-rc.d kdm reload || true
        fi

        # Remove diversion - but only if there isn't any other theme package that needs it:
            find /usr/share/desktop-base/profiles/kde-profile/share/config -maxdepth 1 -name ".ksplashrc.*.id" > /dev/null \ 
            || dpkg-divert --package desktop-theme-growing --remove --rename \
            --divert /usr/share/desktop-base/profiles/kde-profile/share/config/ksplashrc.real \
            /usr/share/desktop-base/profiles/kde-profile/share/config/ksplashrc

        # Remove the small id that signaled the existence of another theme package to this one:
        find /usr/share/desktop-base/profiles/kde-profile/share/config/ -name ".ksplashrc.growing.id" -delete

        # Remove Gnome wallpaper launcher:
        rm -f /etc/xdg/autostart/growing-autostart.desktop
    ;;

    purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

    *)
        echo "postrm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac


# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0