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 -2 | 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.org${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 if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh ] 45 then 46 rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh 47 fi 48 shift 49elif [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ -n "$1" ] 50then 51 echo 52 echo " using: setsdkenv_unix [options]" 53 echo "" 54 echo " options:" 55 echo " --force-configure : force a new configuration of your SDK environment." 56 echo " Alternatively can you edit your SDK environment scripts directly:" 57 echo " $HOME/$OO_SDK_NAME/setsdkenv_unix.sh" 58 echo " $HOME/$OO_SDK_NAME/setsdkenv_unix.csh" 59 echo " -h, --help : print this help and exit" 60 echo 61 exit 1 62fi 63 64# source the prepared environment and start a new shell 65if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ] 66then 67 . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh 68else 69 echo 70 echo " ************************************************************************" 71 echo " *" 72 echo " * You have to configure your SDK environment first before you can" 73 echo " * can use it! The configuration has to be done only once." 74 echo " *" 75 echo " ************************************************************************" 76 echo 77 78 perl $OO_SDK_HOME/configure.pl $HOSTNAME $OO_SDK_HOME $OO_SDK_NAME 79 80 . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh 81fi 82 83"$SHELL" "$@" 84echo Shell terminated. 85 86TERMHEAD=$HOSTNAME 87echo "]2;$TERMHEAD" 88