configurationengine/source/cone.sh
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
equal deleted inserted replaced
-1:000000000000 0:2e8eeb919028
       
     1 #!/bin/bash
       
     2 #
       
     3 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 # All rights reserved.
       
     5 # This component and the accompanying materials are made available
       
     6 # under the terms of "Eclipse Public License v1.0"
       
     7 # which accompanies this distribution, and is available
       
     8 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 #
       
    10 # Initial Contributors:
       
    11 # Nokia Corporation - initial contribution.
       
    12 #
       
    13 # Contributors:
       
    14 #
       
    15 # Description: 
       
    16 #  ConE tool wrapper for Unix
       
    17 
       
    18 # Check that Python is available
       
    19 # ------------------------------
       
    20 python --version &> /dev/null
       
    21 if [ $? -ne 0 ]
       
    22 then
       
    23     echo "Python is required to run ConE!"
       
    24     exit 1
       
    25 fi
       
    26 
       
    27 
       
    28 # Determine the path where ConE is installed
       
    29 # ------------------------------------------
       
    30 
       
    31 # Try to derefence a symlink
       
    32 SCRIPT_FILE=`readlink $0`
       
    33 if [ "$SCRIPT_FILE" = "" ]
       
    34 then
       
    35     # Not a symlink, the first command line parameter can be used
       
    36     SCRIPT_FILE=$0
       
    37 fi
       
    38 CONE_BASEDIR=`dirname "$SCRIPT_FILE"`/cone
       
    39 
       
    40 
       
    41 # Find out the Python version
       
    42 # ---------------------------
       
    43 PYTHON_VERSION=`python -c "import sys; print sys.version[:3]"`
       
    44 #echo "Python version: $PYTHON_VERSION"
       
    45 
       
    46 
       
    47 # Set the correct lib and scripts directories
       
    48 # to use based on the Python version
       
    49 # -------------------------------------------
       
    50 case $PYTHON_VERSION in
       
    51 "2.5")
       
    52     CONE_BASEDIR="$CONE_BASEDIR/2.5"
       
    53     ;;
       
    54 "2.6")
       
    55     CONE_BASEDIR="$CONE_BASEDIR/2.6"
       
    56     ;;
       
    57 *)
       
    58     echo "You are using an unsupported Python version ($PYTHON_VERSION)"
       
    59     echo "ConE requires Python 2.5 or 2.6"
       
    60     exit 1
       
    61     ;;
       
    62 esac
       
    63 
       
    64 #echo "CONE_BASEDIR: $CONE_BASEDIR"
       
    65 
       
    66 
       
    67 # Check that this ConE installation supports the Python version
       
    68 # -------------------------------------------------------------
       
    69 if [ ! -e "$CONE_BASEDIR" ]
       
    70 then
       
    71     echo "Python version $PYTHON_VERSION is not supported by this ConE installation"
       
    72     exit 1
       
    73 fi
       
    74 
       
    75 
       
    76 # Override PYTHONPATH so that the libraries in
       
    77 # the standalone installation are used
       
    78 # --------------------------------------------
       
    79 export PYTHONPATH="$CONE_BASEDIR/lib:$PYTHONPATH"
       
    80 
       
    81 # Run cone_tool.py
       
    82 # ----------------
       
    83 python $CONE_BASEDIR/scripts/cone_tool.py $@