home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 December / Chip_2000-12_cd1.bin / tema / starof / f_0237 / soffice
Text File  |  2000-05-10  |  4KB  |  173 lines

  1. #!/bin/sh
  2. #
  3. # StarOffice startup script
  4. # (c) 1999 Sun Microsystems, Inc.
  5.  
  6. #
  7. # STAR_PROFILE_LOCKING_DISABLED=1
  8. # export STAR_PROFILE_LOCKING_DISABLED
  9. #
  10.  
  11. # uncomment this to remote start soffice on hostname  
  12. # SO_REMOTE_START=rsh
  13. # SO_REMOTE_APPLICATION=hostname:/fully_quallified_path/soffice
  14.  
  15. # set -x
  16.  
  17. # resolve installation directory
  18. sd_platform=`uname -s`
  19. case $sd_platform in
  20.     SCO_SV) test=/bin/test     ;;
  21.       *)      test=/usr/bin/test ;;
  22. esac
  23.  
  24. sd_cwd="`pwd`"
  25. if $test -L "$0" ; then
  26.     sd_basename=`basename $0`
  27.      sd_script=`ls -l $0 | sed "s/.*${sd_basename} -> //g"` 
  28. else
  29.     sd_script="$0"
  30. fi
  31.  
  32. cd "`dirname "$sd_script"`/.."
  33. sd_binary=`basename "$sd_script"`".bin"
  34. sd_inst="`pwd`"
  35.  
  36. # change back directory
  37. cd "$sd_cwd"
  38.  
  39. sd_fonts="$sd_inst/share/fonts"
  40.  
  41. # check if all required patches are installed
  42. if [ -x "$sd_inst/program/sopatchlevel.sh" ]; then
  43.     "$sd_inst/program/sopatchlevel.sh"
  44.     if [ $? -eq 1 ]; then
  45.         exit 0
  46.     fi
  47. fi
  48.  
  49. # extend the ld_library_path for java: javaldx checks the sofficerc for us
  50. java_ld_library_path=`"$sd_inst/program/javaldx" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"`
  51. if [ "$java_ld_library_path" != "" ] ; then
  52.     LD_LIBRARY_PATH=${java_ld_library_path}:${LD_LIBRARY_PATH}
  53. fi
  54.  
  55. # set java environment variables
  56. THREADS_TYPE=native_threads
  57.  
  58. # set search path for shared libraries
  59. case $sd_platform in
  60.   SunOS)
  61.     LD_LIBRARY_PATH="$sd_inst/program":/usr/openwin/lib:/usr/dt/lib:$LD_LIBRARY_PATH
  62.     export LD_LIBRARY_PATH
  63.     ;;
  64.  
  65.   AIX)
  66.     LIBPATH="$sd_inst/program":$LIBPATH
  67.     export LIBPATH
  68.     ;;
  69.  
  70.   HP-UX)
  71.     SHLIB_PATH="$sd_inst/program":/usr/openwin/lib:$SHLIB_PATH
  72.     export SHLIB_PATH
  73.     ;;
  74.  
  75.   IRIX)
  76.     LD_LIBRARYN32_PATH=:"$sd_inst/program":$LD_LIBRARYN32_PATH
  77.     export LD_LIBRARYN32_PATH
  78.     ;;
  79.  
  80.   Linux)
  81.     LD_LIBRARY_PATH="$sd_inst/program":$LD_LIBRARY_PATH
  82.     export LD_LIBRARY_PATH
  83.     ;;
  84.  
  85.   *)
  86.     LD_LIBRARY_PATH="$sd_inst/program":$LD_LIBRARY_PATH
  87.     export LD_LIBRARY_PATH
  88.     ;;
  89. esac
  90.  
  91. # misc. environment variables
  92. SAL_FONTPATH="$sd_fonts/75dpi:unscaled;$sd_fonts/type1;$sd_fonts/75dpi"
  93. XPPATH="$sd_inst/share/xp3"
  94.  
  95. unset XENVIRONMENT
  96.  
  97. export SAL_FONTPATH XPPATH
  98.  
  99. # error message function
  100. err () {
  101.     echo "`basename $0`: $@" 1>&2
  102.     exit 1
  103. }
  104.  
  105. #
  106. # parse command line arguments
  107. #
  108.  
  109. for DUMMY in ${1+"$@"}
  110. do
  111.     case $1 in
  112.  
  113.     ?display) 
  114.         if [ $# -lt 2 ]; then
  115.             err "$1 option requires a display name"
  116.         fi
  117.         DISPLAY=$2
  118.         export DISPLAY
  119.         shift; shift
  120.         ;;
  121.     ?rsh)
  122.         SO_REMOTE_START="rsh";
  123.         shift
  124.         ;;
  125.     ?norsh)
  126.         SO_REMOTE_START="norsh";
  127.         shift
  128.         ;;
  129.     ?server)
  130.         # set the application server 
  131.         if [ $# -lt 2 ]; then
  132.             err "$1 option requires hostname:/path_to_executable as argument"
  133.         fi
  134.         # dont overrule external settings
  135.         if [ "X${SO_REMOTE_APPLICATION}" = "X" ]; then
  136.             SO_REMOTE_APPLICATION=$2;
  137.         fi
  138.         shift; shift
  139.         ;;
  140.     *)
  141.         break;
  142.         ;;
  143.     esac
  144. done
  145.  
  146. # start soffice by remote shell
  147. if [ "X${SO_REMOTE_START}" = "Xrsh" ]; then
  148.     remote_server=`echo ${SO_REMOTE_APPLICATION} | sed 's/:.*//g'`
  149.     remote_path=`echo ${SO_REMOTE_APPLICATION} | sed 's/.*://g'`
  150.     echo remote_server=\"${remote_server}\" remote_path=\"${remote_path}\"
  151.     if [ "X${DISPLAY}" = "X" ]; then
  152.         local_display=`uname -n`:0
  153.     else
  154.         local_display=${DISPLAY}
  155.     fi
  156.  
  157.     if [ "X${remote_server}" != "X" -a "X${remote_path}" != "X" ]; then
  158.         rsh ${remote_server} ${remote_path} -norsh -display ${local_display}
  159.         exit 0
  160.     else
  161.         err "invalid rsh arguments host=\"$remote_server\", command=\"${remote_path}\""
  162.     fi
  163. fi
  164.  
  165. # set path so that other apps can be started from soffice just by name
  166. PATH="$sd_inst/program":$PATH
  167. export PATH
  168.  
  169. # execute soffice binary
  170. # there is a bug in solaris sh that prevents the use of "$@"
  171. # because it cannot cope with spaces in directory names
  172. exec "$sd_inst/program/$sd_binary" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
  173.