[Libreoffice-commits] core.git: bin/run

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 19 07:02:51 UTC 2018


 bin/run |   69 +++++++++++++++++++---------------------------------------------
 1 file changed, 21 insertions(+), 48 deletions(-)

New commits:
commit 78073ecfdc50e78e3ce094c1259779b7c3b88bc4
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Dec 18 18:35:45 2018 +0000
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Dec 19 08:02:27 2018 +0100

    Refactor bin/run
    
    Just merges some common code into setdefaults.
    
    Change-Id: I2ba2c06425bcfe569fa147af713a064a145a2018
    Reviewed-on: https://gerrit.libreoffice.org/65367
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/bin/run b/bin/run
index 51de1f153512..6ac27b9424d7 100755
--- a/bin/run
+++ b/bin/run
@@ -9,8 +9,8 @@
 
 # simple wrapper script to run non-installed executables from workdir
 
-if uname | grep -i CYGWIN >/dev/null; then
-
+setdefaults()
+{
     dir=$(realpath "$(pwd)")
 
     while test ! -d "${dir}/instdir/program" ; do
@@ -21,15 +21,18 @@ if uname | grep -i CYGWIN >/dev/null; then
         dir=$(realpath "${dir}/..")
     done
 
+    exedir="${dir}"/workdir/LinkTarget/Executable
+    export URE_BOOTSTRAP=file://"${dir}"/instdir/program/fundamentalrc
+}
+
+if uname | grep -i CYGWIN >/dev/null; then
+
+    setdefaults
+
     exedir=$(cygpath -m "${dir}"/workdir/LinkTarget/Executable)
     export URE_BOOTSTRAP=file:///$(cygpath -m "${dir}")/instdir/program/fundamental.ini
     export PATH=${PATH:+$PATH:}"${dir}"/instdir/program
-
-#    echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
-#    echo "setting search path to: ${PATH}"
-#    echo "execing: ${exedir}/$1"
-
-    exec ${LO_TRACE} "${exedir}/$@"
+    SEARCH_PATH="${PATH}"
 
 elif [ $(uname) = Darwin ]; then
 
@@ -43,60 +46,30 @@ elif [ $(uname) = Darwin ]; then
         exit 1
     fi
 
-    exedir="${dir}"/workdir/LinkTarget/Executable
     export URE_BOOTSTRAP=file://"${dir}"/instdir/$PRODUCTNAME.app/Contents/Resources/fundamentalrc
     export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+$DYLD_LIBRARY_PATH:}"${dir}"/instdir/$PRODUCTNAME.app/Contents/Frameworks
-
-#    echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
-#    echo "setting search path to: ${DYLD_LIBRARY_PATH}"
-#    echo "execing: ${exedir}/$1"
-
-    exec ${LO_TRACE} "${exedir}/$@"
+    SEARCH_PATH="${DYLD_LIBRARY_PATH}"
 
 elif [ $(uname) = Haiku ]; then
 
-    dir=$(readlink -f "$(pwd)")
+    setdefaults
 
-    while test ! -d "${dir}/instdir/program" ; do
-        if test "${dir}" = "/"; then
-            echo "error: cannot find \"program\" dir from \"$(pwd)\""
-            exit 1
-        fi
-        dir=$(readlink -f "${dir}/..")
-    done
-
-    exedir="${dir}"/workdir/LinkTarget/Executable
-    export URE_BOOTSTRAP=file://"${dir}"/instdir/program/fundamentalrc
     export LIBRARY_PATH=${LIBRARY_PATH:+$LIBRARY_PATH:}"${dir}"/instdir/program
-
-#    echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
-#    echo "setting search path to: ${LIBRARY_PATH}"
-#    echo "execing: ${exedir}/$1"
-
-    exec ${LO_TRACE} "${exedir}/$@"
+    SEARCH_PATH="${LIBRARY_PATH}"
 
 else
 
-    dir=$(readlink -f "$(pwd)")
+    setdefaults
 
-    while test ! -d "${dir}/instdir/program" ; do
-        if test "${dir}" = "/"; then
-            echo "error: cannot find \"program\" dir from \"$(pwd)\""
-            exit 1
-        fi
-        dir=$(readlink -f "${dir}/..")
-    done
-
-    exedir="${dir}"/workdir/LinkTarget/Executable
-    export URE_BOOTSTRAP=file://"${dir}"/instdir/program/fundamentalrc
     export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"${dir}"/instdir/program
+    SEARCH_PATH="${LD_LIBRARY_PATH}"
 
-#    echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
-#    echo "setting search path to: ${LD_LIBRARY_PATH}"
-#    echo "execing: ${exedir}/$1"
+fi
 
-    exec ${LO_TRACE} "${exedir}/$@"
+# echo "setting URE_BOOTSTRAP to: ${URE_BOOTSTRAP}"
+# echo "setting search path to: ${SEARCH_PATH}"
+# echo "execing: ${exedir}/$1"
 
-fi
+exec ${LO_TRACE} "${exedir}/$@"
 
 # vi:set shiftwidth=4 expandtab:


More information about the Libreoffice-commits mailing list