1#! /bin/sh 2# ************************************************************* 3# 4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at 11# 12# http://www.apache.org/licenses/LICENSE-2.0 13# 14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. 20# 21# ************************************************************* 22 23OSTYPE=`uname -s` 24HOSTNAME=`hostname` 25CURRENTDIR=`/bin/pwd` 26SDKTMPDIR=`dirname $0` 27OO_SDK_HOME=`(cd $SDKTMPDIR && pwd && cd $CURRENTDIR) | head -n 1` 28OOVERSION=`cat $OO_SDK_HOME/settings/dk.mk | tail -3 | head -n 1 | cut -d"=" -f2 | cut -d"." -f1,2` 29if [ "$OSTYPE" = "Darwin" ] 30then 31 OO_SDK_NAME=`basename $OO_SDK_HOME` 32else 33 OO_SDK_NAME=openoffice${OOVERSION}_sdk 34fi 35 36export OO_SDK_HOME 37 38if [ "$1" = "--force-configure" ] 39then 40 if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ] 41 then 42 rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh 43 fi 44 shift 45elif [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ -n "$1" ] 46then 47 echo 48 echo " using: setsdkenv_unix [options]" 49 echo "" 50 echo " options:" 51 echo " --force-configure : force a new configuration of your SDK environment." 52 echo " Alternatively can you edit your SDK environment script directly:" 53 echo " $HOME/$OO_SDK_NAME/setsdkenv_unix.sh" 54 echo " -h, --help : print this help and exit" 55 echo 56 exit 1 57fi 58 59# source the prepared environment and start a new shell 60if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ] 61then 62 . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh 63else 64 echo 65 echo " ************************************************************************" 66 echo " *" 67 echo " * You have to configure your SDK environment first before you can" 68 echo " * can use it! The configuration has to be done only once." 69 echo " *" 70 echo " ************************************************************************" 71 echo 72 73 perl $OO_SDK_HOME/configure.pl $HOSTNAME $OO_SDK_HOME $OO_SDK_NAME 74 75 . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh 76fi 77 78"$SHELL" "$@" 79echo Shell terminated. 80 81TERMHEAD=$HOSTNAME 82echo "]2;$TERMHEAD" 83