xref: /aoo41x/main/desktop/scripts/soffice.sh (revision fce70c9b)
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/../basis-link/program/pagein" -L"$sd_prog/../basis-link/program" \
85    ${sd_pagein_args}
86
87# extend the ld_library_path for java: javaldx checks the sofficerc for us
88if [ -x "$sd_prog/../basis-link/ure-link/bin/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/../basis-link/program"
93	sd_prog2="$sd_prog/../basis-link/ure-link/lib"
94	LD_LIBRARY_PATH=$sd_prog1:$sd_prog2${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}
95	export LD_LIBRARY_PATH
96	;;
97    esac
98    my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
99        "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
100    if [ -n "$my_path" ] ; then
101        LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
102        export LD_LIBRARY_PATH
103    fi
104fi
105
106unset XENVIRONMENT
107
108# uncomment line below to disable anti aliasing of fonts
109# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
110
111# uncomment line below if you encounter problems starting soffice on your system
112# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
113
114# read database entries for Adabas D
115if [ -f /etc/adabasrc ]; then
116  . /etc/adabasrc
117fi
118
119# execute soffice binary
120"$sd_prog/$sd_binary" "$@" &
121trap 'kill -9 $!' TERM
122wait $!
123sd_ret=$?
124
125while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
126do
127    if [ $sd_ret -eq 79 ]; then
128        "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
129    elif [ $sd_ret -eq 81 ]; then
130        "$sd_prog/$sd_binary" "$@" &
131    fi
132
133    wait $!
134    sd_ret=$?
135done
136
137exit $sd_ret
138