#!/bin/sh

set -e

case "$1" in
    remove|upgrade|deconfigure)

    kconf="/etc/kernel-img.conf"
    hookline="header_postinst_hook = /etc/kernel/postinst.d/dkms"

    if [ -e $kconf ]; then
	if grep -c "$hookline" "$kconf" ; then
	    temp=`mktemp /tmp/dkms.XXXXXX`
	    grep -v "$hookline" "$kconf" > "$temp"
	    mv "$temp" "$kconf"
	fi
    fi
    ;;

    failed-upgrade)
    ;;

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

#DEBHELPER#

exit 0


