home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / lib / openoffice / program / soffice < prev    next >
Encoding:
Text File  |  2007-04-10  |  9.0 KB  |  370 lines

  1. #!/bin/sh
  2. #*************************************************************************
  3. #
  4. #   OpenOffice.org - a multi-platform office productivity suite
  5. #
  6. #   $RCSfile: soffice.sh,v $
  7. #
  8. #   $Revision: 1.25 $
  9. #
  10. #   last change: $Author: kz $ $Date: 2006/07/05 22:33:58 $
  11. #
  12. #   The Contents of this file are made available subject to
  13. #   the terms of GNU Lesser General Public License Version 2.1.
  14. #
  15. #
  16. #     GNU Lesser General Public License Version 2.1
  17. #     =============================================
  18. #     Copyright 2005 by Sun Microsystems, Inc.
  19. #     901 San Antonio Road, Palo Alto, CA 94303, USA
  20. #
  21. #     This library is free software; you can redistribute it and/or
  22. #     modify it under the terms of the GNU Lesser General Public
  23. #     License version 2.1, as published by the Free Software Foundation.
  24. #
  25. #     This library is distributed in the hope that it will be useful,
  26. #     but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. #     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  28. #     Lesser General Public License for more details.
  29. #
  30. #     You should have received a copy of the GNU Lesser General Public
  31. #     License along with this library; if not, write to the Free Software
  32. #     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  33. #     MA  02111-1307  USA
  34. #
  35. #*************************************************************************
  36.  
  37. #
  38. # STAR_PROFILE_LOCKING_DISABLED=1
  39. # export STAR_PROFILE_LOCKING_DISABLED
  40. #
  41.  
  42. # Ubuntu helper functions
  43. file_or_home_on_nfs()
  44. {
  45.     case $(stat -f -c %T $HOME) in nfs*|smb)
  46.         return 0
  47.     esac
  48.     for i; do
  49.        case "$i" in -*) continue; esac
  50.        [ -f "$i" ] || continue
  51.        case $(stat -f -c %T "$i") in nfs*|smb)
  52.             return 0
  53.        esac
  54.     done
  55.     return 1
  56. }
  57.  
  58. # FIXME: this is conservative; allow more known working configurations
  59. working_opengl_support()
  60. {
  61.     if [ -n "$(lsmod | awk '/^(fglrx|nvidia)/ {print $1}')" ]; then
  62.     return 1
  63.     fi
  64.     return 0
  65. }
  66.  
  67. # read Ubuntu config file
  68.  
  69. FILE_LOCKING=auto
  70. OPENGL_SUPPORT=yes
  71. if [ -f /etc/openoffice/soffice.sh ]; then
  72.     . /etc/openoffice/soffice.sh
  73. fi
  74.  
  75. # sanity checks
  76.  
  77. case "$FILE_LOCKING" in
  78.     auto|yes|no) ;;
  79.     *)
  80.         echo >&2 "unknown value '$FILE_LOCKING' for FILE_LOCKING parameter."
  81.     FILE_LOCKING=auto
  82.     echo >&2 "FILE_LOCKING reset to '$FILE_LOCKING'"
  83. esac
  84.     
  85. case "$OPENGL_SUPPORT" in
  86.     auto|yes|no) ;;
  87.     *)
  88.         echo >&2 "unknown value '$OPENGL_SUPPORT' for OPENGL_SUPPORT parameter."
  89.     OPENGL_SUPPORT=auto
  90.     echo >&2 "OPENGL_SUPPORT reset to '$OPENGL_SUPPORT'"
  91. esac
  92.  
  93. # adjust environment
  94.  
  95. if [ -z "$SAL_ENABLE_FILE_LOCKING" ]; then
  96.     case "$FILE_LOCKING" in
  97.     auto)
  98.         if ! file_or_home_on_nfs "$@"; then
  99.             # file locking now enabled by default
  100.         SAL_ENABLE_FILE_LOCKING=1
  101.         export SAL_ENABLE_FILE_LOCKING
  102.     fi
  103.         ;;
  104.     yes)
  105.     SAL_ENABLE_FILE_LOCKING=1
  106.     export SAL_ENABLE_FILE_LOCKING
  107.         ;;
  108.     no)
  109.     SAL_ENABLE_FILE_LOCKING=0
  110.     export SAL_ENABLE_FILE_LOCKING
  111.     esac
  112. fi
  113.  
  114. if [ -z "$SAL_NOOPENGL" ]; then
  115.     case "$OPENGL_SUPPORT" in
  116.     auto)
  117.         if ! working_opengl_support; then
  118.         SAL_NOOPENGL=true
  119.         export SAL_NOOPENGL
  120.     fi
  121.         ;;
  122.     yes)
  123.     :
  124.     unset SAL_NOOPENGL
  125.     #export SAL_NOOPENGL
  126.         ;;
  127.     no)
  128.     SAL_NOOPENGL=true
  129.     export SAL_NOOPENGL
  130.     esac
  131. fi
  132.  
  133.  
  134. # other Ubuntu stuff
  135.  
  136. # turn off autohinting for thai (Ubuntu #35305).
  137. case "$LANG" in th*)
  138.     SAL_AUTOHINTING_PRIORITY=0
  139.     export SAL_AUTOHINTING_PRIORITY
  140. esac
  141.  
  142. sd_platform=`uname -s`
  143.  
  144. # the following test is needed on Linux PPC with IBM j2sdk142
  145. if [ $sd_platform = "Linux" -a "`uname -m`" = "ppc" ] ; then
  146.     JITC_PROCESSOR_TYPE=6
  147.     export JITC_PROCESSOR_TYPE
  148. fi
  149.  
  150. # set -x
  151.  
  152. # resolve installation directory
  153. sd_cwd="`pwd`"
  154. if [ -h "$0" ] ; then
  155.     sd_basename=`basename "$0"`
  156.      sd_script=`ls -l "$0" | sed "s/.*${sd_basename} -> //g"` 
  157.     cd "`dirname "$0"`"
  158.     cd "`dirname "$sd_script"`"
  159. else
  160.     cd "`dirname "$0"`"
  161. fi
  162.  
  163. sd_prog="`pwd`"
  164.  
  165. cd ..
  166. sd_binary=`basename "$0"`".bin"
  167. sd_inst="`pwd`"
  168.  
  169. # change back directory
  170. cd "$sd_cwd"
  171.  
  172. # check if all required patches are installed
  173. if [ -x "$sd_prog/sopatchlevel.sh" ]; then
  174.     "$sd_prog/sopatchlevel.sh"
  175.     if [ $? -eq 1 ]; then
  176.         exit 0
  177.     fi
  178. fi
  179.  
  180. # set search path for shared libraries
  181. add_moz_lib=
  182. for moz_lib_path in \
  183.     $MOZILLA_LIBRARY_PATH \
  184.     /usr/lib \
  185.     /usr/lib/mozilla \
  186.     /usr/lib/mozilla-firefox \
  187.     /usr/lib/mozilla-thunderbird \
  188.     /opt/mozilla/lib \
  189.     /opt/MozillaFirefox/lib \
  190.     /opt/MozillaThunderbird/lib; \
  191. do
  192.     if [ -f $moz_lib_path/libnss3.so ]; then
  193.     case "$moz_lib_path" in
  194.         /usr/lib|/usr/lib64) : ;;
  195.         *) add_moz_lib=":$moz_lib_path"
  196.     esac
  197.     break
  198.     fi
  199. done
  200. case $sd_platform in
  201.   AIX)
  202.     # this is a temporary hack until we can live with the default search paths
  203.     if [ $LIBPATH ]; then
  204.       SYSTEM_LIBPATH=$LIBPATH
  205.       export SYSTEM_LIBPATH
  206.       LIBPATH="$sd_prog$add_moz_lib":$LIBPATH
  207.     else
  208.       LIBPATH="$sd_prog$add_moz_lib"
  209.     fi
  210.     export LIBPATH
  211.     ;;
  212.  
  213.   Darwin)
  214.     # this is a temporary hack until we can live with the default search paths
  215.     if [ $DYLD_LIBRARY_PATH ]; then 
  216.       SYSTEM_DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
  217.       export SYSTEM_DYLD_LIBRARY_PATH
  218.       DYLD_LIBRARY_PATH="$sd_prog$add_moz_lib":$DYLD_LIBRARY_PATH
  219.     else
  220.       DYLD_LIBRARY_PATH="$sd_prog$add_moz_lib"
  221.     fi
  222.     export DYLD_LIBRARY_PATH
  223.     ;;
  224.  
  225.   HP-UX)
  226.     # this is a temporary hack until we can live with the default search paths
  227.     if [ $SHLIB_PATH ]; then
  228.       SYSTEM_SHLIB_PATH=$SHLIB_PATH
  229.       export SYSTEM_SHLIB_PATH
  230.       SHLIB_PATH="$sd_prog$add_moz_lib":/usr/openwin/lib:$SHLIB_PATH
  231.     else
  232.       SHLIB_PATH="$sd_prog$add_moz_lib":/usr/openwin/lib
  233.     fi
  234.     export SHLIB_PATH
  235.     ;;
  236.  
  237.   IRIX*)
  238.     # this is a temporary hack until we can live with the default search paths
  239.     if [ $LD_LIBRARYN32_PATH ]; then
  240.        SYSTEM_LD_LIBRARYN32_PATH=$LD_LIBRARYN32_PATH
  241.        export SYSTEM_LD_LIBRARYN32_PATH
  242.        LD_LIBRARYN32_PATH=:"$sd_prog$add_moz_lib":$LD_LIBRARYN32_PATH
  243.     else
  244.        LD_LIBRARYN32_PATH=:"$sd_prog$add_moz_lib"
  245.     fi
  246.     export LD_LIBRARYN32_PATH
  247.     ;;
  248.  
  249.   *)
  250.     # this is a temporary hack until we can live with the default search paths
  251.     if [ $LD_LIBRARY_PATH ]; then
  252.       SYSTEM_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
  253.       export SYSTEM_LD_LIBRARY_PATH
  254.       LD_LIBRARY_PATH="$sd_prog$add_moz_lib":$LD_LIBRARY_PATH
  255.     else
  256.       LD_LIBRARY_PATH="$sd_prog$add_moz_lib"
  257.     fi
  258.     export LD_LIBRARY_PATH
  259.     ;;
  260. esac
  261.  
  262. #collect all bootstrap variables specified on the command line
  263. #so that they can be passed as arguments to javaldx later on
  264. for arg in $@
  265. do
  266.   case "$arg" in
  267.        -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
  268.   esac
  269. done
  270.  
  271. # extend the ld_library_path for java: javaldx checks the sofficerc for us
  272. if [ -x "$sd_prog/javaldx" ] ; then
  273.     java_ld_library_path=`"$sd_prog/javaldx" $BOOTSTRAPVARS`
  274.     if [ "$java_ld_library_path" != "" ] ; then
  275.         case $sd_platform in
  276.             AIX)
  277.                 LIBPATH=${java_ld_library_path}:${LIBPATH}
  278.                 ;;
  279.             Darwin)
  280.                 DYLD_LIBRARY_PATH=${java_ld_library_path}:${DYLD_LIBRARY_PATH}
  281.                 ;;
  282.             HP-UX)
  283.                 SHLIB_PATH=${java_ld_library_path}:${SHLIB_PATH}
  284.                 ;;
  285.             IRIX*)
  286.                 LD_LIBRARYN32_PATH=${java_ld_library_path}:${LD_LIBRARYN32_PATH}
  287.                 ;;
  288.             *)
  289.                 LD_LIBRARY_PATH=${java_ld_library_path}:${LD_LIBRARY_PATH}
  290.                 ;;
  291.         esac
  292.     fi
  293. fi
  294.  
  295. # misc. environment variables
  296. OPENOFFICE_MOZILLA_FIVE_HOME="$sd_inst/program"
  297. export OPENOFFICE_MOZILLA_FIVE_HOME
  298.  
  299. if [ -z "$MOZILLA_CERTIFICATE_FOLDER" ]; then
  300.     db=""
  301.     dir=""
  302.     for d in $HOME/.mozilla/firefox $HOME/.firefox $HOME/.mozilla-thunderbird $HOME/.mozilla/default $HOME/.mozilla; do
  303.         if [ -z "$dir" -a -d "$d" ]; then
  304.             dir=$d;
  305.         fi;
  306.     done
  307.     if [ -n "$dir" ]; then
  308.         cert8=`find $dir -name "cert8.db" | head -n 1`
  309.         if [ -n "$cert8" ]; then
  310.             profiledir=`dirname "$cert8"`
  311.             MOZILLA_CERTIFICATE_FOLDER=$profiledir
  312.             export MOZILLA_CERTIFICATE_FOLDER
  313.         fi
  314.     fi
  315. fi
  316.  
  317. unset XENVIRONMENT
  318.  
  319. # uncomment line below to disable anti aliasing of fonts
  320. # SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
  321.  
  322. # pagein
  323. for sd_arg in ${1+"$@"} ; do
  324.     case ${sd_arg} in
  325.     -calc)
  326.         sd_pagein_args="${sd_pagein_args:+${sd_pagein_args} }@pagein-calc"
  327.         break;
  328.         ;;
  329.     -draw)
  330.         sd_pagein_args="${sd_pagein_args:+${sd_pagein_args} }@pagein-draw"
  331.         break;
  332.         ;;
  333.     -impress)
  334.         sd_pagein_args="${sd_pagein_args:+${sd_pagein_args} }@pagein-impress"
  335.         break;
  336.         ;;
  337.     -writer)
  338.         sd_pagein_args="${sd_pagein_args:+${sd_pagein_args} }@pagein-writer"
  339.         break;
  340.         ;;
  341.     *)
  342.         ;;
  343.     esac
  344. done
  345.  
  346. sd_pagein_args="${sd_pagein_args:+${sd_pagein_args} }@pagein-common"
  347. "${sd_prog}"/pagein -L"${sd_prog}" ${sd_pagein_args}
  348.  
  349. # set path so that other apps can be started from soffice just by name
  350. if [ "$PATH" ]; then
  351.   PATH="$sd_prog":$PATH
  352. else
  353.   PATH="$sd_prog"
  354. fi
  355. export PATH
  356.  
  357.  
  358. # execute soffice binary
  359. "$sd_prog/$sd_binary" "$@" &
  360. trap 'kill -9 $!' TERM
  361. wait $!
  362.  
  363. while [ $? -eq 79 ]
  364. do
  365.     "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
  366.     wait $!
  367. done
  368.  
  369. exit
  370.