xref: /aoo4110/main/desktop/scripts/soffice.sh (revision b1cdbd2c)
1#!/bin/sh
2#**************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21#**************************************************************
22
23#
24# STAR_PROFILE_LOCKING_DISABLED=1
25# export STAR_PROFILE_LOCKING_DISABLED
26#
27
28# file locking now enabled by default
29SAL_ENABLE_FILE_LOCKING=1
30export SAL_ENABLE_FILE_LOCKING
31
32# Uncomment the line below if you suspect that OpenGL is not
33# working on your system.
34# SAL_NOOPENGL=true; export SAL_NOOPENGL
35
36# The following is needed on Linux PPC with IBM j2sdk142:
37#@# export JITC_PROCESSOR_TYPE=6
38
39# resolve installation directory
40sd_cwd=`pwd`
41sd_res=$0
42while [ -h "$sd_res" ] ; do
43    cd "`dirname "$sd_res"`"
44    sd_basename=`basename "$sd_res"`
45    sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
46done
47cd "`dirname "$sd_res"`"
48sd_prog=`pwd`
49cd "$sd_cwd"
50
51sd_binary=`basename "$0"`.bin
52
53#collect all bootstrap variables specified on the command line
54#so that they can be passed as arguments to javaldx later on
55for arg in $@
56do
57  case "$arg" in
58       -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
59  esac
60done
61
62# pagein
63sd_pagein_args=@pagein-common
64for sd_arg in "$@"; do
65    case ${sd_arg} in
66    -calc)
67        sd_pagein_args="${sd_pagein_args} @pagein-calc"
68        break;
69        ;;
70    -draw)
71        sd_pagein_args="${sd_pagein_args} @pagein-draw"
72        break;
73        ;;
74    -impress)
75        sd_pagein_args="${sd_pagein_args} @pagein-impress"
76        break;
77        ;;
78    -writer)
79        sd_pagein_args="${sd_pagein_args} @pagein-writer"
80        break;
81        ;;
82    esac
83done
84"$sd_prog/pagein" -L"$sd_prog" \
85    ${sd_pagein_args}
86
87# extend the ld_library_path for java: javaldx checks the sofficerc for us
88if [ -x "$sd_prog/javaldx" ] ; then
89    # this is a temporary hack until we can live with the default search paths
90    case "`uname -s`" in
91    FreeBSD)
92	sd_prog1="$sd_prog"
93	LD_LIBRARY_PATH=$sd_prog1:${LD_LIBRARY_PATH}}
94	export LD_LIBRARY_PATH
95	;;
96    esac
97    my_path=`"$sd_prog/javaldx" $BOOTSTRAPVARS \
98        "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
99    if [ -n "$my_path" ] ; then
100        LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
101        export LD_LIBRARY_PATH
102    fi
103fi
104
105unset XENVIRONMENT
106
107# uncomment line below to disable anti aliasing of fonts
108# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
109
110# uncomment line below if you encounter problems starting soffice on your system
111# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
112
113# read database entries for Adabas D
114if [ -f /etc/adabasrc ]; then
115  . /etc/adabasrc
116fi
117
118# execute soffice binary
119"$sd_prog/$sd_binary" "$@" &
120trap 'kill -9 $!' TERM
121wait $!
122sd_ret=$?
123
124while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
125do
126    if [ $sd_ret -eq 79 ]; then
127        "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
128    elif [ $sd_ret -eq 81 ]; then
129        "$sd_prog/$sd_binary" "$@" &
130    fi
131
132    wait $!
133    sd_ret=$?
134done
135
136exit $sd_ret
137