UpdateIconCache()
{
        if [ -f /usr/bin/gtk-update-icon-cache ]
        then
                echo -n "updating hicolor icon cache..."
                if gtk-update-icon-cache -f -t /usr/share/icons/hicolor > /dev/null 2>&1 ; then
                        echo " done."
                else
                        echo " failed."
                fi
        fi
        if [ -f /usr/bin/gtk-update-icon-cache-3.0 ]
        then
                echo -n "updating hicolor icon cache gtk+3..."
                if gtk-update-icon-cache-3.0 -f -t /usr/share/icons/hicolor > /dev/null 2>&1 ; then
                        echo " done."
                else
                        echo " failed."
                fi
        fi
}

post_install()
{
        UpdateIconCache
        systemctl enable ModemManager.service >/dev/null 2>&1
}

post_upgrade()
{
        post_install
        systemctl daemon-reload >/dev/null 2>&1
}

pre_remove()
{
        systemctl --no-reload disable ModemManager.service >/dev/null 2>&1
}

post_remove()
{
        UpdateIconCache
        systemctl daemon-reload >/dev/null 2>&1
}

op=$1
shift

$op $*


