#! /bin/sh
# preinst script for cedarview-drm
#
# see: dh_installdeb(1)
#
# Copyright (C) 2012 Canonical Ltd
# Authors: Alberto Milone

set -e

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
#
# For details see /usr/share/doc/packaging-manual/


case "$1" in
    install|upgrade)
    # We need to remove diversions from previous versions of the package
    if dpkg-divert --list /etc/lightdm/lightdm.conf | grep 'cedarview-drm' > /dev/null ; then
        rm -f /etc/lightdm/lightdm.conf
        dpkg-divert --remove --rename --package cedarview-drm --divert /etc/lightdm/lightdm.conf.cedarview-drm /etc/lightdm/lightdm.conf > /dev/null
    fi

    # Add the new diversion
    dpkg-divert --add --rename --package cedarview-drm --divert /etc/lightdm/lightdm.conf.cedarview-drm /etc/lightdm/lightdm.conf > /dev/null
    ;;

    abort-upgrade)
    ;;

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



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

#DEBHELPER#

exit 0

