Version 1.9 :
[macros-openoffice.git] / auf-poste-client-reflets / debian / preinst
1 #!/bin/sh
2
3 set -e
4
5 flush_unopkg_cache() {
6   /usr/lib/openoffice/program/unopkg list --shared > /dev/null 2>&1
7 }
8
9 remove_extension() {
10   if /usr/lib/openoffice/program/unopkg list --shared $1 >/dev/null; then
11     echo -n "Removing extension $1..."
12     INSTDIR=`mktemp -d`
13     if test -d "/usr/lib/openoffice/basis3.1"
14     then
15       export PYTHONPATH="/usr/lib/openoffice/basis3.1/program"
16       basis=`readlink /usr/lib/openoffice/basis-link`
17       /usr/lib/openoffice/program/unopkg remove --shared $1 \
18         "-env:UserInstallation=file://$INSTDIR" \
19         "-env:UNO_JAVA_JFW_INSTALL_DATA=file:///var/lib/openoffice/$basis/share/config/javasettingsunopkginstall.xml" \
20         "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
21     else
22       /usr/lib/openoffice/program/unopkg remove --shared $1 \
23         "-env:UserInstallation=file://$INSTDIR" \
24         '-env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml' \
25         "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
26     fi
27     if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
28     echo " done."
29     flush_unopkg_cache
30   fi
31 }
32
33 if [ "$1" = "upgrade" ]; then
34   # this is a legacy package, so we need to find it first...
35   id=`/usr/lib/openoffice/program/unopkg list --shared | grep Identifier:.*auf.*reflets | cut -d":" -f2`
36   remove_extension $id
37 fi
38
39 exit 0