configurationengine/source/cone.sh
author terytkon
Sat, 06 Nov 2010 16:59:14 +0200
changeset 9 63964d875993
parent 3 e7e0ae78773e
permissions -rw-r--r--
Merge changes to system model generator to SF tip.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     1
#!/bin/bash
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     2
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     3
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     4
# All rights reserved.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     5
# This component and the accompanying materials are made available
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     6
# under the terms of "Eclipse Public License v1.0"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     7
# which accompanies this distribution, and is available
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     8
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     9
#
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    10
# Contributors:
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    11
# Nokia Corporation - initial contribution.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    12
#
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    13
# Description:
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    14
#  ConE tool wrapper for Unix
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    15
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    16
# Check that Python is available
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    17
# ------------------------------
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    18
python -c None &> /dev/null
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    19
if [ $? -ne 0 ]
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    20
then
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    21
    echo "Python is required to run ConE!"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    22
    exit 1
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    23
fi
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    24
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    25
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    26
# Determine the path where ConE is installed
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    27
# ------------------------------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    28
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    29
SCRIPT_FILE=`readlink -f $0`
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    30
CONE_BASEDIR=`dirname "$SCRIPT_FILE"`/configurationengine/linux
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    31
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    32
if [ ! -e "$CONE_BASEDIR" ]
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    33
then
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    34
    echo "Cannot run ConE, the ConE base directory does not exist:"
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    35
    echo $CONE_BASEDIR
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    36
    exit 1
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    37
fi
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    38
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    39
# Find out the Python version
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    40
# ---------------------------
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    41
PYTHON_VERSION=`python -c "import sys; sys.stdout.write(sys.version[:3])"`
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    42
#echo "Python version: $PYTHON_VERSION"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    43
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    44
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    45
# Set the correct lib and scripts directories
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    46
# to use based on the Python version
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    47
# -------------------------------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    48
case $PYTHON_VERSION in
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    49
"2.5")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    50
    CONE_BASEDIR="$CONE_BASEDIR/2.5"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    51
    ;;
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    52
"2.6")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    53
    CONE_BASEDIR="$CONE_BASEDIR/2.6"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    54
    ;;
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    55
*)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    56
    echo "You are using an unsupported Python version ($PYTHON_VERSION)"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    57
    echo "ConE requires Python 2.5 or 2.6"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    58
    exit 1
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    59
    ;;
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    60
esac
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    61
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    62
#echo "CONE_BASEDIR: $CONE_BASEDIR"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    63
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    64
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    65
# Check that this ConE installation supports the Python version
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    66
# -------------------------------------------------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    67
if [ ! -e "$CONE_BASEDIR" ]
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    68
then
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    69
    echo "Python version $PYTHON_VERSION is not supported by this ConE installation"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    70
    exit 1
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    71
fi
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    72
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    73
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    74
# Override PYTHONPATH so that the libraries in
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    75
# the standalone installation are used
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    76
# --------------------------------------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    77
export PYTHONPATH="$CONE_BASEDIR/lib:$PYTHONPATH"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    78
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    79
# Run cone_tool.py
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    80
# ----------------
3
e7e0ae78773e ConE 1.2.11 release
m2lahtel
parents: 0
diff changeset
    81
python $CONE_BASEDIR/scripts/cone_tool.py "$@"