xref: /aoo41x/main/desktop/scripts/soffice.sh (revision 30971150)
1cdf0e10cSrcweir#!/bin/sh
2cdf0e10cSrcweir#*************************************************************************
3cdf0e10cSrcweir#
4cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5cdf0e10cSrcweir#
6cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates.
7cdf0e10cSrcweir#
8cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
9cdf0e10cSrcweir#
10cdf0e10cSrcweir# This file is part of OpenOffice.org.
11cdf0e10cSrcweir#
12cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
13cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
14cdf0e10cSrcweir# only, as published by the Free Software Foundation.
15cdf0e10cSrcweir#
16cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
17cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
18cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
20cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
21cdf0e10cSrcweir#
22cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
23cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
24cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
25cdf0e10cSrcweir# for a copy of the LGPLv3 License.
26cdf0e10cSrcweir#
27cdf0e10cSrcweir#*************************************************************************
28cdf0e10cSrcweir
29cdf0e10cSrcweir#
30cdf0e10cSrcweir# STAR_PROFILE_LOCKING_DISABLED=1
31cdf0e10cSrcweir# export STAR_PROFILE_LOCKING_DISABLED
32cdf0e10cSrcweir#
33cdf0e10cSrcweir
34cdf0e10cSrcweir# file locking now enabled by default
35cdf0e10cSrcweirSAL_ENABLE_FILE_LOCKING=1
36cdf0e10cSrcweirexport SAL_ENABLE_FILE_LOCKING
37cdf0e10cSrcweir
38cdf0e10cSrcweir# Uncomment the line below if you suspect that OpenGL is not
39cdf0e10cSrcweir# working on your system.
40cdf0e10cSrcweir# SAL_NOOPENGL=true; export SAL_NOOPENGL
41cdf0e10cSrcweir
42cdf0e10cSrcweir# The following is needed on Linux PPC with IBM j2sdk142:
43cdf0e10cSrcweir#@# export JITC_PROCESSOR_TYPE=6
44cdf0e10cSrcweir
45cdf0e10cSrcweir# resolve installation directory
46cdf0e10cSrcweirsd_cwd=`pwd`
47cdf0e10cSrcweirsd_res=$0
48cdf0e10cSrcweirwhile [ -h "$sd_res" ] ; do
49cdf0e10cSrcweir    cd "`dirname "$sd_res"`"
50cdf0e10cSrcweir    sd_basename=`basename "$sd_res"`
51cdf0e10cSrcweir    sd_res=`ls -l "$sd_basename" | sed "s/.*$sd_basename -> //g"`
52cdf0e10cSrcweirdone
53cdf0e10cSrcweircd "`dirname "$sd_res"`"
54cdf0e10cSrcweirsd_prog=`pwd`
55cdf0e10cSrcweircd "$sd_cwd"
56cdf0e10cSrcweir
57cdf0e10cSrcweirsd_binary=`basename "$0"`.bin
58cdf0e10cSrcweir
59cdf0e10cSrcweir#collect all bootstrap variables specified on the command line
60cdf0e10cSrcweir#so that they can be passed as arguments to javaldx later on
61cdf0e10cSrcweirfor arg in $@
62cdf0e10cSrcweirdo
63cdf0e10cSrcweir  case "$arg" in
64cdf0e10cSrcweir       -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
65cdf0e10cSrcweir  esac
66cdf0e10cSrcweirdone
67cdf0e10cSrcweir
68cdf0e10cSrcweir# pagein
69cdf0e10cSrcweirsd_pagein_args=@pagein-common
70cdf0e10cSrcweirfor sd_arg in "$@"; do
71cdf0e10cSrcweir    case ${sd_arg} in
72cdf0e10cSrcweir    -calc)
73cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-calc"
74cdf0e10cSrcweir        break;
75cdf0e10cSrcweir        ;;
76cdf0e10cSrcweir    -draw)
77cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-draw"
78cdf0e10cSrcweir        break;
79cdf0e10cSrcweir        ;;
80cdf0e10cSrcweir    -impress)
81cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-impress"
82cdf0e10cSrcweir        break;
83cdf0e10cSrcweir        ;;
84cdf0e10cSrcweir    -writer)
85cdf0e10cSrcweir        sd_pagein_args="${sd_pagein_args} @pagein-writer"
86cdf0e10cSrcweir        break;
87cdf0e10cSrcweir        ;;
88cdf0e10cSrcweir    esac
89cdf0e10cSrcweirdone
90cdf0e10cSrcweir"$sd_prog/../basis-link/program/pagein" -L"$sd_prog/../basis-link/program" \
91cdf0e10cSrcweir    ${sd_pagein_args}
92cdf0e10cSrcweir
93cdf0e10cSrcweir# extend the ld_library_path for java: javaldx checks the sofficerc for us
94cdf0e10cSrcweirif [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then
95*30971150SPedro Giffuni    # this is a temporary hack until we can live with the default search paths
96*30971150SPedro Giffuni    case "`uname -s`" in
97*30971150SPedro Giffuni    FreeBSD)
98*30971150SPedro Giffuni	sd_prog1="$sd_prog/../basis-link/program"
99*30971150SPedro Giffuni	sd_prog2="$sd_prog/../basis-link/ure-link/lib"
100*30971150SPedro Giffuni	LD_LIBRARY_PATH=$sd_prog1:$sd_prog2${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}
101*30971150SPedro Giffuni	export LD_LIBRARY_PATH
102*30971150SPedro Giffuni	;;
103*30971150SPedro Giffuni    esac
104cdf0e10cSrcweir    my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
105cdf0e10cSrcweir        "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
106cdf0e10cSrcweir    if [ -n "$my_path" ] ; then
107cdf0e10cSrcweir        LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
108cdf0e10cSrcweir        export LD_LIBRARY_PATH
109cdf0e10cSrcweir    fi
110cdf0e10cSrcweirfi
111cdf0e10cSrcweir
112cdf0e10cSrcweirunset XENVIRONMENT
113cdf0e10cSrcweir
114cdf0e10cSrcweir# uncomment line below to disable anti aliasing of fonts
115cdf0e10cSrcweir# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
116cdf0e10cSrcweir
117cdf0e10cSrcweir# uncomment line below if you encounter problems starting soffice on your system
118cdf0e10cSrcweir# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
119cdf0e10cSrcweir
120cdf0e10cSrcweir# read database entries for Adabas D
121cdf0e10cSrcweirif [ -f /etc/adabasrc ]; then
122cdf0e10cSrcweir  . /etc/adabasrc
123cdf0e10cSrcweirfi
124cdf0e10cSrcweir
125cdf0e10cSrcweir# execute soffice binary
126cdf0e10cSrcweir"$sd_prog/$sd_binary" "$@" &
127cdf0e10cSrcweirtrap 'kill -9 $!' TERM
128cdf0e10cSrcweirwait $!
129cdf0e10cSrcweirsd_ret=$?
130cdf0e10cSrcweir
131cdf0e10cSrcweirwhile [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
132cdf0e10cSrcweirdo
133cdf0e10cSrcweir    if [ $sd_ret -eq 79 ]; then
134cdf0e10cSrcweir        "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
135cdf0e10cSrcweir    elif [ $sd_ret -eq 81 ]; then
136cdf0e10cSrcweir        "$sd_prog/$sd_binary" "$@" &
137cdf0e10cSrcweir    fi
138cdf0e10cSrcweir
139cdf0e10cSrcweir    wait $!
140cdf0e10cSrcweir    sd_ret=$?
141cdf0e10cSrcweirdone
142cdf0e10cSrcweir
143cdf0e10cSrcweirexit $sd_ret
144