diff options
Diffstat (limited to 'app-office/openoffice/files/1.1.5/ooffice-wrapper-1.3')
-rw-r--r-- | app-office/openoffice/files/1.1.5/ooffice-wrapper-1.3 | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/app-office/openoffice/files/1.1.5/ooffice-wrapper-1.3 b/app-office/openoffice/files/1.1.5/ooffice-wrapper-1.3 new file mode 100644 index 000000000000..78b242ca2c9a --- /dev/null +++ b/app-office/openoffice/files/1.1.5/ooffice-wrapper-1.3 @@ -0,0 +1,197 @@ +#!/bin/sh +# +# Wrapper script for openoffice +# +# (C) Peter 'Nidd' Novodvorsky, 2001,2002 +# (C) Martin 'empty' Quinson, 2002. +# Modifications by Chris Halls +# Modifications by Lucien Saviot + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# this string should be exactly as in ~/.sversionrc +PV=<pv> +OOVERSION="OpenOffice.org ${PV}" + +## +## Source system configuration file +## +[ -r /etc/openoffice/openoffice.conf ] && . /etc/openoffice/openoffice.conf + +# Migration to new user install dir +if [ -d "$HOME/.openoffice/1.1.4" ] ; then + mv $HOME/.openoffice/1.1.4 $HOME/.openoffice/1.1.5 + sed -i -e s/'.openoffice\/1.1.4'/'.openoffice\/1.1.5'/g $HOME/.sversionrc + sed -i -e s/1.1.4/1.1.5/g $HOME/.openoffice/1.1.5/user/basic/*.xlc + echo "Your user install dir has been moved over to the new version" +fi + +#Make smooth up- and downgrading between minor versions possible +if [ -e "$HOME/.sversionrc" ] ; then + sed -i -e s/1.1.4/1.1.5/g $HOME/.sversionrc +fi + +if [ ! -f "/proc/version" ] ; then + echo "--- Warning - OO.o will not work without a mounted /proc filesystem ---" +fi + +### +### Get user settings directory from ~/.sversionrc and echo directory name to stdout +### get_settings_dir <Version> +### return: 0 - directory found, +### 1 - ~/.sversionrc non existent +### 2 - entry exists in ~/.sversionrc but directory not found +### 3 - ~/.sversionrc exists but no entry found +get_settings_dir() +{ + [ -r ${HOME}/.sversionrc ] || exit 1 + # warning, .sversionrc is DOS encoded so strip ^M + settings_dir="`tr -d '\r' < ~/.sversionrc | sed -n "/^$1=/s%^$1=file://\(.*\)$%\1%p"`" + echo "$settings_dir" + [ -n "$settings_dir" ] || exit 3 + [ -d "$settings_dir" ] || exit 2 +} + +## +## where does OO live for this user ? +## +OOHOME="`get_settings_dir "$OOVERSION"`" +if [ $? -eq 2 ] ; then + # .sversionrc contains a version yet the directory does not exist + echo "I'm confused because I can't find OpenOffice's user files." + echo "Your ~/.sversionrc file tells they should be under $OOHOME," + echo "but they are not. Please fix the situation manually." + echo "You may want to edit ~/.sversionrc to indicate where is OO" + echo "installed, or remove it if you did remove your installation" + echo "directory manually (you bad one)." + exit 1 +fi + +## +## Add /usr/share/fonts to font search path +## + +# Default font path. This is used if SAL_FONTPATH_PRIVATE is not defined. + +GENTOO_FONTPATH="" +for d in `find /usr/share/fonts -maxdepth 1 -mindepth 1 -type d` ; do + GENTOO_FONTPATH="$GENTOO_FONTPATH;$d" +done + +SAL_FONTPATH_PRIVATE=${SAL_FONTPATH_PRIVATE:-"$GENTOO_FONTPATH"} +export SAL_FONTPATH_PRIVATE + +## search LOCALE +if [ -n "$LC_ALL" ]; then + LOCALE="$LC_ALL" + # OOo doesn't understand LC_ALL, so set LANG + LANG="$LC_ALL" +elif [ -n "$LANG" ]; then + LOCALE="$LANG" +elif [ -n "$LC_MESSAGES" ]; then + LOCALE="$LC_MESSAGES" + LANG="$LC_MESSAGES" +else + LOCALE="en_US" +fi + +# Set locale to en_US if locale is C +if [ "x$LOCALE" = "xC" ] ; then LOCALE="en_US"; fi + +LOCALEOO=`echo $LOCALE | sed 's/_/-/'` + +## +## install OO for this user if needed +## +if [ -z "$OOHOME" ] ; then + if [ -e /etc/openoffice/autoresponse-<pv>.conf ] && \ + grep -q DESTINATIONPATH /etc/openoffice/autoresponse-<pv>.conf ; then + + # first install + OOHOME=`grep DESTINATIONPATH /etc/openoffice/autoresponse-<pv>.conf | \ + sed -e 's/DESTINATIONPATH=//' -e "s|<home>|$HOME|"` + + if [ -d "$OOHOME" ]; then + echo "openoffice.org: You have no entry for $OOVERSION in ~/.sversionrc, " + echo "yet the directory $OOHOME exists." + echo "Please remove $OOHOME and try again." + exit 1 + fi + + echo "running openoffice.org setup..." + if ! /opt/OpenOffice.org/program/setup -R:/etc/openoffice/autoresponse-<pv>.conf >& /dev/null; then + echo "setup failed.. abort" + exit 1 + fi + + echo "Setup complete. Running openoffice.org..." + +else + echo "openoffice.org: Damnit! I can't find OpenOffice's user files. Did you break" + echo "the /etc/openoffice/autoresponse-<pv>.conf file manually ?" + echo "This file should contain DESTINATIONPATH" + exit 1 + fi +fi + +## +## If no file is specified on the command line, which application to start? +## The wrapper can be called from several links in /usr/bin +## +if [ $# = 0 ]; then + case `basename $0` in + oocalc) set -- private:factory/scalc;; + oodraw) set -- private:factory/sdraw;; + ooimpress) set -- private:factory/simpress;; + oomath) set -- private:factory/smath;; + ooweb) set -- private:factory/swriter/web;; + oowriter) set -- private:factory/swriter;; + oomaster) set -- private:factory/swriter/Global;; + esac +fi + +## Previous dead installation? +[ -d $HOME/.openoffice/user ] && echo "Warning: you have a user settings directory from 1.0.0 in ~/.openoffice/user - this is no longer used" + +# Check whether the programs actually link to anything, or are from an old +# version. + +if [ ! -s $OOHOME/setup ]; then + echo "${OOHOME}/setup links to nothing, resetting link" + ln -sf /opt/OpenOffice.org/program/setup ${OOHOME}/setup +fi +if [ ! -s $OOHOME/soffice ]; then + echo "${OOHOME}/soffice links to nothing, resetting link" + ln -sf /opt/OpenOffice.org/program/soffice ${OOHOME}/soffice +fi +if [ ! -s $OOHOME/spadmin ]; then + echo "${OOHOME}/spadmin links to nothing, resetting link" + ln -sf /opt/OpenOffice.org/program/soffice ${OOHOME}/spadmin +fi + + +## +## That's it. Launch the beast (with the given args) +## +LANG=$LOCALE +export LANG +case `basename $0` in + oosetup) exec "$OOHOME/setup" + ;; + oopadmin) exec "$OOHOME/spadmin" + ;; + *) exec "$OOHOME/soffice" "$@" + ;; +esac |