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