#!/bin/bash # # Script by Silvio Rhatto (rhatto at riseup.net). # # This 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 any later version. # # This SlackBuild 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 # # $HOME/.openoffice32: # # chroot_script="/usr/bin/openoffice-chroot" # office="/opt/OpenOffice.org/program" # chroot="/usr/slack32" # wrapper="/usr/bin/openoffice-wrapper" # function eval_param { echo `grep -e "^$1=" $HOME/.openoffice32 | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | cut -d "#" -f 1` } me=`whoami` if [ -f $HOME/.openoffice32 ]; then office="`eval_param office`" chroot_script="`eval_param chroot_script`" else office="/opt/OpenOffice.org/program" chroot_script="/usr/bin/openoffice-chroot" fi if [[ "$#" > 1 ]]; then for ((num = 2; num <= $#; num++)); do args="$args${!num}" done else unset args fi if [ -d /usr/lib64 ]; then # we are in slamd64 if [ -z "$args" ]; then sudo $chroot_script $1 $me else sudo $chroot_script $1 $me "$args" fi else # we are in slackware 32 if [ -z "$args" ]; then exec $office/$1 else exec $office/$1 "$args" fi fi