Blob Blame History Raw
From 4ee0775161d44acc5089aeec2013d461fe592e23 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 3 Feb 2014 20:24:50 +0100
Subject: [PATCH] i#86080 unopkg bodge

---
 desktop/scripts/unopkg.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/desktop/scripts/unopkg.sh b/desktop/scripts/unopkg.sh
index ca1e3bc..6393e99 100755
--- a/desktop/scripts/unopkg.sh
+++ b/desktop/scripts/unopkg.sh
@@ -78,6 +78,53 @@ if [ "$(id -u)" -eq "0" ]; then
     fi
 fi
 
+if [ $isnotuser -eq 1 ]; then
+    echo $@ | grep -q env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY
+    if [ $? -ne 0 ]; then
+        set -- $@ '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'
+    fi
+    echo $@ | grep -q env:UNO_JAVA_JFW_INSTALL_DATA
+    if [ $? -ne 0 -a -w $sd_prog/../share/config/javasettingsunopkginstall.xml ]; then
+        set -- $@ '-env:UNO_JAVA_JFW_INSTALL_DATA=$$ORIGIN/../share/config/javasettingsunopkginstall.xml'
+    fi
+    echo $@ | grep -q env:UserInstallation
+    if [ $? -ne 0 ]; then
+        INSTDIR=`/bin/mktemp -d --tmpdir unoinstall.XXXXXX`
+        if [ $? -ne 0 ]; then
+            echo "Could not create tmp dir" >&2
+            exit 1
+        fi
+        set -- $@ '-env:UserInstallation=file://'$INSTDIR
+    fi
+fi
+
+isnotuser=0
+for arg in $@
+do
+if [ "$arg" = "--shared" -o "$arg" = "--bundled" ]; then
+    isnotuser=1
+fi
+done
+if [ $isnotuser -eq 1 ]; then
+    echo $@ | grep -q env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY
+    if [ $? -ne 0 ]; then
+        set -- $@ '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'
+    fi
+    echo $@ | grep -q env:UNO_JAVA_JFW_INSTALL_DATA
+    if [ $? -ne 0 -a -w $sd_prog/../share/config/javasettingsunopkginstall.xml ]; then
+        set -- $@ '-env:UNO_JAVA_JFW_INSTALL_DATA=$$ORIGIN/../share/config/javasettingsunopkginstall.xml'
+    fi
+    echo $@ | grep -q env:UserInstallation
+    if [ $? -ne 0 ]; then
+        INSTDIR=`/bin/mktemp -d --tmpdir unoinstall.XXXXXX`
+        if [ $? -ne 0 ]; then
+            echo "Could not create tmp dir" >&2
+            exit 1
+        fi
+        set -- $@ '-env:UserInstallation=file://'$INSTDIR
+    fi
+fi
+
 # extend the ld_library_path for java: javaldx checks the sofficerc for us
 if [ -x "${sd_prog}/javaldx" ] ; then
     my_path=`"${sd_prog}/javaldx" $BOOTSTRAPVARS \
@@ -106,6 +153,8 @@ unset XENVIRONMENT
 # SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
 
 # execute binary
-exec "$sd_prog/unopkg.bin" "$@" \
+"$sd_prog/unopkg.bin" "$@" \
     "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"
-
+if [ -n "$INSTDIR" ]; then
+   rm -rf $INSTDIR
+fi
-- 
2.4.2