Version 1.9 :
[macros-openoffice.git] / auf-poste-client-reflets / debian / preinst
index ecd844f..f0b180e 100644 (file)
@@ -1,7 +1,5 @@
 #!/bin/sh
 
-exit 0
-
 set -e
 
 flush_unopkg_cache() {
@@ -12,10 +10,20 @@ remove_extension() {
   if /usr/lib/openoffice/program/unopkg list --shared $1 >/dev/null; then
     echo -n "Removing extension $1..."
     INSTDIR=`mktemp -d`
-    /usr/lib/openoffice/program/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 test -d "/usr/lib/openoffice/basis3.1"
+    then
+      export PYTHONPATH="/usr/lib/openoffice/basis3.1/program"
+      basis=`readlink /usr/lib/openoffice/basis-link`
+      /usr/lib/openoffice/program/unopkg remove --shared $1 \
+        "-env:UserInstallation=file://$INSTDIR" \
+        "-env:UNO_JAVA_JFW_INSTALL_DATA=file:///var/lib/openoffice/$basis/share/config/javasettingsunopkginstall.xml" \
+        "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
+    else
+      /usr/lib/openoffice/program/unopkg remove --shared $1 \
+        "-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
     echo " done."
     flush_unopkg_cache
@@ -24,7 +32,7 @@ remove_extension() {
 
 if [ "$1" = "upgrade" ]; then
   # this is a legacy package, so we need to find it first...
-  id=`/usr/lib/openoffice/program/unopkg list --shared | grep Identifier:.*auf-reflets-tse | cut -d":" -f2`
+  id=`/usr/lib/openoffice/program/unopkg list --shared | grep Identifier:.*auf.*reflets | cut -d":" -f2`
   remove_extension $id
 fi