#!/bin/sh
RPM_INSTALL_PREFIX=/opt
export RPM_INSTALL_PREFIX
# if this is an update, remove the old package instance first
test "$1" = "2" || exit 0

#Find the temp dir
if [ -n "$TMPDIR" ]; then
  UNOPKGTMP="$TMPDIR"
elif [ -n "$TMP" ]; then
  UNOPKGTMP="$TMP"
elif [ -d "/tmp" ]; then
  UNOPKGTMP="/tmp"
else
  echo "No tmp directory found!"
  exit 1
fi

#Create the command which creates a temporary directory
if [ -x "/bin/mktemp" ]
then
  INSTDIR=`/bin/mktemp -d "${UNOPKGTMP}/userinstall.XXXXXX"`
else
  INSTDIR="${UNOPKGTMP}/userinstall.$$"
  mkdir "$INSTDIR"
fi

if [ -x "$RPM_INSTALL_PREFIX/openoffice.org3/program/unopkg" ]; then
  "$RPM_INSTALL_PREFIX/openoffice.org3/program/unopkg" remove --shared --bundled "dict-en.oxt" "-env:UserInstallation=file://$INSTDIR" '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'
fi

if [ -n "$INSTDIR" ]; then
  rm -rf "$INSTDIR"
fi

exit 0           
                                   