#!/bin/sh
# This maintainer script was originally written by Harri Pitkänen, Teemu Likonen
# and Timo Jyrinki and was adoptet from the openoffice.org-voikko package. It
# was modified by Sebastian Humenda to fit for the accessodf package.

PATH=/bin:/usr/bin:/usr/lib/libreoffice/program
set -e

flush_unopkg_cache() {
    HOME=$INSTDIR unopkg list --shared "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1" > /dev/null 2>&1
}

remove_extension() {
    INSTDIR=`mktemp -d`
    if HOME=$INSTDIR unopkg list --shared $1 >/dev/null; then
        echo -n "Removing extension $1..."
        HOME=$INSTDIR unopkg remove --shared $1 \
        "-env:UserInstallation=file://$INSTDIR" \
        '-env:UNO_JAVA_JFW_INSTALL_DATA=$ORIGIN/../share/config/javasettingsunopkginstall.xml' \
        "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
    if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
    echo " done."
    flush_unopkg_cache
    fi
}

case "$1" in
    remove)
        remove_extension be.docarch.accessodf.ooo.accessodfaddon
    ;;
esac


#DEBHELPER#
