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