xref: /aoo42x/main/odk/setsdkenv_unix (revision cdf0e10c)
1#! /bin/sh
2
3OSTYPE=`uname -s`
4HOSTNAME=`hostname`
5CURRENTDIR=`/bin/pwd`
6SDKTMPDIR=`dirname $0`
7OO_SDK_HOME=`(cd $SDKTMPDIR && pwd && cd $CURRENTDIR) | head -n 1`
8OOVERSION=`cat $OO_SDK_HOME/settings/dk.mk | tail -2 | head -n 1 | cut -d"=" -f2 | cut -d"." -f1,2`
9if [ "$OSTYPE" = "Darwin" ]
10then
11    OO_SDK_NAME=`basename $OO_SDK_HOME`
12else
13    OO_SDK_NAME=openoffice.org${OOVERSION}_sdk
14fi
15
16export OO_SDK_HOME
17
18if [ "$1" = "--force-configure" ]
19then
20    if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
21    then
22	rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
23    fi
24    if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh ]
25    then
26	rm $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.csh
27    fi
28    shift
29elif [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ -n "$1" ]
30then
31    echo
32    echo " using: setsdkenv_unix [options]"
33    echo ""
34    echo " options:"
35    echo "   --force-configure : force a new configuration of your SDK environment."
36    echo "                       Alternatively can you edit your SDK environment scripts directly:"
37    echo "                        $HOME/$OO_SDK_NAME/setsdkenv_unix.sh"
38    echo "                        $HOME/$OO_SDK_NAME/setsdkenv_unix.csh"
39    echo "   -h, --help        : print this help and exit"
40    echo
41    exit 1
42fi
43
44# source the prepared environment and start a new shell
45if [ -r $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh ]
46then
47    . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
48else
49    echo
50    echo " ************************************************************************"
51    echo " *"
52    echo " *  You have to configure your SDK environment first before you can"
53    echo " *  can use it! The configuration has to be done only once."
54    echo " *"
55    echo " ************************************************************************"
56    echo
57
58    perl $OO_SDK_HOME/configure.pl $HOSTNAME $OO_SDK_HOME $OO_SDK_NAME
59
60    . $HOME/$OO_SDK_NAME/$HOSTNAME/setsdkenv_unix.sh
61fi
62
63"$SHELL" "$@"
64echo  Shell terminated.
65
66TERMHEAD=$HOSTNAME
67echo "]2;$TERMHEAD"
68