home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / lib / openoffice / program / unopkg < prev    next >
Encoding:
Text File  |  2012-10-08  |  5.2 KB  |  188 lines

  1. #!/bin/sh
  2. #*************************************************************************
  3. #
  4. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. #
  6. # Copyright 2000, 2010 Oracle and/or its affiliates.
  7. #
  8. # OpenOffice.org - a multi-platform office productivity suite
  9. #
  10. # This file is part of OpenOffice.org.
  11. #
  12. # OpenOffice.org is free software: you can redistribute it and/or modify
  13. # it under the terms of the GNU Lesser General Public License version 3
  14. # only, as published by the Free Software Foundation.
  15. #
  16. # OpenOffice.org is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. # GNU Lesser General Public License version 3 for more details
  20. # (a copy is included in the LICENSE file that accompanied this code).
  21. #
  22. # You should have received a copy of the GNU Lesser General Public License
  23. # version 3 along with OpenOffice.org.  If not, see
  24. # <http://www.openoffice.org/license.html>
  25. # for a copy of the LGPLv3 License.
  26. #
  27. #*************************************************************************
  28.  
  29. if test -z "$HOME"; then
  30.     HOME=$(getent passwd $(whoami) | cut -d":" -f6)
  31. fi
  32.  
  33. # helper functions
  34. home_on_nfs()
  35. {
  36.     case $(stat -f -c %T $HOME) in cifs|nfs*|smb)
  37.         return 0
  38.     esac
  39.     return 1
  40. }
  41. file_on_nfs() {
  42.     for i; do
  43.        case "$i" in -*) continue; esac
  44.        [ -f "$i" ] || continue
  45.        case $(stat -f -c %T "$i") in cifs|nfs*|smb)
  46.             return 0
  47.        esac
  48.     done
  49.     return 1
  50. }
  51.  
  52. # read config file
  53.  
  54. FILE_LOCKING=auto
  55. if [ -f /etc/openoffice/soffice.sh ]; then
  56.     . /etc/openoffice/soffice.sh
  57. fi
  58.  
  59. # sanity checks
  60.  
  61. case "$FILE_LOCKING" in
  62.     auto|yes|no) ;;
  63.     *)
  64.         echo >&2 "unknown value '$FILE_LOCKING' for FILE_LOCKING parameter."
  65.        FILE_LOCKING=auto
  66.        echo >&2 "FILE_LOCKING reset to '$FILE_LOCKING'"
  67. esac
  68.  
  69. # resolve installation directory
  70. sd_cwd="`pwd`"
  71. if [ -h "$0" ] ; then
  72.     sd_basename=`basename "$0"`
  73.      sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` 
  74.     cd "`dirname "$0"`"
  75.     cd "`dirname "$sd_script"`"
  76. else
  77.     cd "`dirname "$0"`"
  78. fi
  79. sd_prog=`pwd`
  80. cd "$sd_cwd"
  81.  
  82. isshared=0
  83. for arg in $@
  84. do
  85. if [ "$arg" = "--shared" ]; then 
  86.     isshared=1
  87. fi
  88. done
  89. if [ $isshared -eq 1 ]; then
  90.     echo $@ | grep -q env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY
  91.     if [ $? -ne 0 ]; then
  92.         set -- $@ '-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1'
  93.     fi
  94.     echo $@ | grep -q env:UNO_JAVA_JFW_INSTALL_DATA
  95.     if [ $? -ne 0 -a -w $sd_prog/../share/config/javasettingsunopkginstall.xml ]; then
  96.         set -- $@ '-env:UNO_JAVA_JFW_INSTALL_DATA=$$ORIGIN/../share/config/javasettingsunopkginstall.xml'
  97.     fi
  98.     echo $@ | grep -q env:UserInstallation
  99.     if [ $? -ne 0 ]; then
  100.         INSTDIR=`mktemp -d -t unoinstall.XXXXXX`
  101.         set -- $@ '-env:UserInstallation=file://'$INSTDIR
  102.     fi
  103. fi
  104.  
  105. # adjust environment
  106.  
  107. if [ -z "$SAL_ENABLE_FILE_LOCKING" ]; then
  108.     case "$FILE_LOCKING" in
  109.        auto)
  110.         home_on_nfs "$@"
  111.         if [ $? = 0 ]; then
  112.            STAR_PROFILE_LOCKING_DISABLED=1
  113.            export STAR_PROFILE_LOCKING_DISABLED
  114.        fi
  115.         if [ "$isshared" = "1" ]; then
  116.             file_on_nfs "/var/spool/openoffice/uno_packages"
  117.             if [ $? = 0 ]; then
  118.                 SAL_ENABLE_FILE_LOCKING=0
  119.                 export SAL_ENABLE_FILE_LOCKING
  120.              # for safety
  121.                 STAR_ENABLE_FILE_LOCKING=0
  122.              export STAR_ENABLE_FILE_LOCKING
  123.                 STAR_PROFILE_LOCKING_DISABLED=1
  124.                 export STAR_PROFILE_LOCKING_DISABLED
  125.             else
  126.                  # file locking now enabled by default
  127.                 SAL_ENABLE_FILE_LOCKING=1
  128.                 export SAL_ENABLE_FILE_LOCKING
  129.             fi
  130.         fi
  131.         ;;
  132.        yes)
  133.        SAL_ENABLE_FILE_LOCKING=1
  134.        export SAL_ENABLE_FILE_LOCKING
  135.         ;;
  136.        no)
  137.        SAL_ENABLE_FILE_LOCKING=0
  138.        export SAL_ENABLE_FILE_LOCKING
  139.     # for safety
  140.        STAR_ENABLE_FILE_LOCKING=0
  141.     export STAR_ENABLE_FILE_LOCKING
  142.        STAR_PROFILE_LOCKING_DISABLED=1
  143.        export STAR_PROFILE_LOCKING_DISABLED
  144.     esac
  145. fi
  146.  
  147. #collect all bootstrap variables specified on the command line
  148. #so that they can be passed as arguments to javaldx later on
  149. for arg in $@
  150. do
  151.   case "$arg" in
  152.        -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
  153.   esac
  154. done
  155.  
  156. # extend the ld_library_path for java: javaldx checks the sofficerc for us
  157. if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then
  158.     my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
  159.         "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
  160.     if [ -n "$my_path" ] ; then
  161.         LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  162.         export LD_LIBRARY_PATH
  163.     fi
  164. fi
  165.  
  166. unset XENVIRONMENT
  167.  
  168. # uncomment line below to disable anti aliasing of fonts
  169. # SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
  170.  
  171. # uncomment line below if you encounter problems starting soffice on your system
  172. # SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
  173.  
  174. # Set PATH so that crash_report is found:
  175. PATH=$sd_prog${PATH+:$PATH}
  176. export PATH
  177.  
  178. export PYTHONPATH="/usr/lib/openoffice/basis3.2/program"
  179.  
  180.  
  181.  
  182. # execute binary
  183. "$sd_prog/unopkg.bin" "$@" \
  184.     "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"
  185. if [ -n "$INSTDIR" ]; then
  186.    rm -rf $INSTDIR
  187. fi
  188.