xref: /trunk/main/desktop/scripts/soffice.sh (revision 30971150)
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#
30# STAR_PROFILE_LOCKING_DISABLED=1
31# export STAR_PROFILE_LOCKING_DISABLED
32#
33
34# file locking now enabled by default
35SAL_ENABLE_FILE_LOCKING=1
36export SAL_ENABLE_FILE_LOCKING
37
38# Uncomment the line below if you suspect that OpenGL is not
39# working on your system.
40# SAL_NOOPENGL=true; export SAL_NOOPENGL
41
42# The following is needed on Linux PPC with IBM j2sdk142:
43#@# export JITC_PROCESSOR_TYPE=6
44
45# resolve installation directory
46sd_cwd=`pwd`
47sd_res=$0
48while [ -h "$sd_res" ] ; do
49    cd "`dirname "$sd_res"`"
50    sd_basename=`basename "$sd_res"`
51    sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
52done
53cd "`dirname "$sd_res"`"
54sd_prog=`pwd`
55cd "$sd_cwd"
56
57sd_binary=`basename "$0"`.bin
58
59#collect all bootstrap variables specified on the command line
60#so that they can be passed as arguments to javaldx later on
61for arg in $@
62do
63  case "$arg" in
64       -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
65  esac
66done
67
68# pagein
69sd_pagein_args=@pagein-common
70for sd_arg in "$@"; do
71    case ${sd_arg} in
72    -calc)
73        sd_pagein_args="${sd_pagein_args} @pagein-calc"
74        break;
75        ;;
76    -draw)
77        sd_pagein_args="${sd_pagein_args} @pagein-draw"
78        break;
79        ;;
80    -impress)
81        sd_pagein_args="${sd_pagein_args} @pagein-impress"
82        break;
83        ;;
84    -writer)
85        sd_pagein_args="${sd_pagein_args} @pagein-writer"
86        break;
87        ;;
88    esac
89done
90"$sd_prog/../basis-link/program/pagein" -L"$sd_prog/../basis-link/program" \
91    ${sd_pagein_args}
92
93# extend the ld_library_path for java: javaldx checks the sofficerc for us
94if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then
95    # this is a temporary hack until we can live with the default search paths
96    case "`uname -s`" in
97    FreeBSD)
98	sd_prog1="$sd_prog/../basis-link/program"
99	sd_prog2="$sd_prog/../basis-link/ure-link/lib"
100	LD_LIBRARY_PATH=$sd_prog1:$sd_prog2${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}
101	export LD_LIBRARY_PATH
102	;;
103    esac
104    my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
105        "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
106    if [ -n "$my_path" ] ; then
107        LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
108        export LD_LIBRARY_PATH
109    fi
110fi
111
112unset XENVIRONMENT
113
114# uncomment line below to disable anti aliasing of fonts
115# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
116
117# uncomment line below if you encounter problems starting soffice on your system
118# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
119
120# read database entries for Adabas D
121if [ -f /etc/adabasrc ]; then
122  . /etc/adabasrc
123fi
124
125# execute soffice binary
126"$sd_prog/$sd_binary" "$@" &
127trap 'kill -9 $!' TERM
128wait $!
129sd_ret=$?
130
131while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
132do
133    if [ $sd_ret -eq 79 ]; then
134        "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
135    elif [ $sd_ret -eq 81 ]; then
136        "$sd_prog/$sd_binary" "$@" &
137    fi
138
139    wait $!
140    sd_ret=$?
141done
142
143exit $sd_ret
144