
check_run_without_errors ()
{
    tempfile=`mktemp -p /tmp checkrun.XXXXXXXX`
    if which $1  >/dev/null; then
        echo -n "Running $*. This may take some time. ..."
	set +e
	if $* > $tempfile 2>&1 ; then
	    rm -f $tempfile
	    echo " done."
	else
	    echo
	    echo "$* failed. Output has been stored in"
	    echo "$tempfile"
	    echo "If tex-common is not configured you can ignore this error message!"
	    echo "Otherwise please include this file if you report a bug."
	    echo
	fi
	set -e
    else
        rm -f $tempfile
    fi
    return 0
}


case "$1" in
    remove|disappear)
        check_run_without_errors update-updmap --quiet
	check_run_without_errors mktexlsr
	check_run_without_errors updmap-sys
    ;;

    purge|upgrade|failed-upgrade|abort-upgrade|abort-install)
    ;;

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


