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