#!/bin/sh
# postrm script

set -e


case "$1" in
    purge|remove|abort-install|disappear)
        FINDVGA=0
        ROOTID=`lspci -x | awk 'BEGIN{ORS=""} NR==4 {print $17 $16};'`
        if [ `lspci -x | awk 'BEGIN{ORS=""} NR==7 {print $2}'` = "VGA" ]; then
            FINDVGA=10
        elif [ `lspci -x | awk 'BEGIN{ORS=""} NR==13 {print $2}'` = "VGA" ]; then
            FINDVGA=16
        fi
        GPUID=`lspci -x | awk 'BEGIN{ORS=""} NR==N {print $17 $16};' N="${FINDVGA}"`
        if [ $FINDVGA = 0 ]; then
            ID=${ROOTID}
        else
            ID=${GPUID}
        fi
        if [ "$ID" = '2255' ]; then
	    if [ -f /usr/lib/pm-utils/sleep.d/99synaptics ]; then
		rm /usr/lib/pm-utils/sleep.d/99synaptics
	    fi
        fi
    ;;
    
    upgrade|failed-upgrade|abort-upgrade)
        exit 0
    ;;

    *)
        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
