#!/bin/sh

PACKAGE=linuxdoc-tools
CENTRALCAT=/etc/sgml/${PACKAGE}.cat

set -e

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

	# for FHS transition: remove the link from FSSTND Doc Dir
	if [ -L /usr/doc/${PACKAGE} ]; then
	  rm -f /usr/doc/${PACKAGE}
	fi

        install-info --quiet --remove linuxdoc-sgml

	# remove old sgml catalog from /etc/sgml/transitional.cat
        install-sgmlcatalog --quiet --remove $PACKAGE

	if [ "$1" = remove ]; then
	    update-catalog --quiet --remove --super ${CENTRALCAT}
	elif [ "$1" = purge ]; then
	    rm -f ${CENTRALCAT} ${CENTRALCAT}.old
	fi

        if command -v install-docs >/dev/null 2>&1; then
          install-docs -r linuxdoc-tools
        fi

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

exit 0

