#!/bin/sh
# sgml-data postinst
#   jobs: remove old catalog entry in transitional.cat
#         add a bunch of entries with 

set -e

PACKAGE=sgml-data

# this file will be automatically created
CENTRALCAT=/etc/sgml/${PACKAGE}.cat

# catalogs to be registered, relative to /usr/share/sgml
# to regenerate this list:
#     find * -name catalog -o -name '*.soc' | xargs echo
ORDCATS="dtd/catalog entities/catalog entities/sgml-iso-entities-8879.1986/catalog entities/xml-iso-entities-8879.1986/catalog html/dtd/4.0/catalog html/dtd/4.01/catalog html/dtd/iso-15445/catalog html/dtd/xml/1.0/xhtml.soc html/dtd/catalog html/entities/catalog"

remove_old_cat ( ) {
    install-sgmlcatalog --quiet --remove sgml-data || true
}

add_new_cats ( ) {
    # add a bunch of ordinary catalogs to our central catalog
    for ordcat in ${ORDCATS}; do
        update-catalog --quiet --add ${CENTRALCAT} /usr/share/sgml/${ordcat}
    done

    # add central catalog to the super catalog
    update-catalog --quiet --add --super ${CENTRALCAT}
}

if [ "$1" = configure ]; then
    remove_old_cat
    add_new_cats
fi

# automatically generated debhelper commands
#DEBHELPER#

exit 0
