#!/bin/sh
# postrm script
#
# see: dh_installdeb(1)

set -e

clean_stuff()
{
    local _prefdir _sourcedir _sharedir
    _prefdir="/etc/apt/preferences.d"
    _sourcedir="/etc/apt/sources.list.d"
    _sharedir="/usr/share/yandex-ubuntu-archive-apt"

    # For each distro remove custom repo
    if `lsb_release -c | grep -q precise` ; then
#        rm -f ${_prefdir}/yandex-ubuntu-archive-precise-pin
        rm -f ${_sourcedir}/yandex-ubuntu-archive-precise.list
    elif `lsb_release -c | grep -q trusty` ; then
#        rm -f ${_prefdir}/yandex-ubuntu-archive-trusty-pin
        rm -f ${_sourcedir}/yandex-ubuntu-archive-trusty.list
    else
        echo "WARNING: Unsupported Linux Distro"
    fi
}

case "$1" in
remove|purge)
    clean_stuff
;;
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

