#! /bin/bash

#   swriter3 - Wrapper for StarWriter 3.1
#   Copyright (c) by Martin Schulze <joey@orgatech.de>
#
#   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., 675 Mass Ave, Cambridge, MA 02139, USA.

short=swriter3
conf=~/.sd.sh
setup=/usr/lib/StarOffice-3.1/setup
prog=/usr/lib/StarOffice-3.1/linux-x86/bin/swriter3

if [ ! -f $conf ]; then
    # Trying to call the setup routing now
    $setup
fi

# In case something went wrong we're checking
# again
if [ -f $conf ]; then
    . $conf
    if [ -x $prog ]; then
	exec $prog
    else
	echo "No $short found as $prog."
    fi
else
    echo "You haven't setup your Star Writer 3.1 environment yet."
    echo "Please run /usr/lib/StarOffice-3.1/setup first."
fi
